Handle publish and save post buttons by storing ID of button pressed
This commit is contained in:
parent
679af01f8d
commit
83543a9232
|
@ -329,7 +329,13 @@ jQuery( function( $ ) {
|
|||
.on( 'change', '#variable_product_options .woocommerce_variations :input', this.input_changed )
|
||||
.on( 'change', '.variations-defaults select', this.defaults_changed );
|
||||
|
||||
$( 'form#post' ).on( 'submit', this.save_on_submit );
|
||||
var postForm = $( 'form#post' );
|
||||
|
||||
postForm.on( 'submit', this.save_on_submit );
|
||||
|
||||
$( 'input:submit', postForm ).bind( 'click keypress', function() {
|
||||
postForm.data( 'callerid', this.id );
|
||||
});
|
||||
|
||||
$( '.wc-metaboxes-wrapper' ).on( 'click', 'a.do_variation_action', this.do_variation_action );
|
||||
},
|
||||
|
@ -524,10 +530,13 @@ jQuery( function( $ ) {
|
|||
* After saved, continue with form submission
|
||||
*/
|
||||
save_on_submit_done: function() {
|
||||
if ( $( '#hidden_post_status' ).val() !== 'publish' ) {
|
||||
$( 'form#post' ).append('<input type="hidden" name="save-post" value="1" />').submit();
|
||||
var postForm = $( 'form#post' ),
|
||||
callerid = postForm.data( 'callerid' );
|
||||
|
||||
if ( 'publish' === callerid ) {
|
||||
postForm.append('<input type="hidden" name="publish" value="1" />').submit();
|
||||
} else {
|
||||
$( 'form#post' ).append('<input type="hidden" name="publish" value="1" />').submit();
|
||||
postForm.append('<input type="hidden" name="save-post" value="1" />').submit();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue