Skip to content

Commit

Permalink
Fixed saving in quick edit mode. #199, #185
Browse files Browse the repository at this point in the history
  • Loading branch information
rilwis committed Jan 27, 2013
1 parent b256401 commit 0e488df
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions inc/classes/meta-box.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,7 @@ public function show()
$classes[] = $field['class'];

printf(
$field['before'] .
'<div class="%s"%s>%s</div>' .
$field['after'],
$field['before'] . '<div class="%s"%s>%s</div>' . $field['after'],
implode( ' ', $classes ),
$group,
$html
Expand Down Expand Up @@ -401,7 +399,7 @@ static function meta( $meta, $post_id, $saved, $field )
*
* @param int $post_id Post ID
*
* @return int|void
* @return void
*/
function save_post( $post_id )
{
Expand All @@ -421,22 +419,24 @@ function save_post( $post_id )
// - the post is a revision
// - current post type is supported
// - user has proper capability
// - in Quick edit mode, @link http://wordpress.org/support/topic/quick-edit-not-working-and-problem-located
if (
( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
|| ( ! isset( $_POST['post_ID'] ) || $post_id != $_POST['post_ID'] )
|| ( ! in_array( $post_type, $this->meta_box['pages'] ) )
|| ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
|| ( 'inline-save' == $_POST['action'] )
)
{
return $post_id;
return;
}

// Verify nonce
check_admin_referer( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );

//Save post action removed to prevent infinite loops
remove_action( 'save_post', array( $this, 'save_post' ) );

//Before save actions
do_action("rwmb_before_save_post", $post_id);
do_action("rwmb_{$this->meta_box['id']}_before_save_post", $post_id);
Expand All @@ -460,11 +460,11 @@ function save_post( $post_id )
// Call defined method to save meta value, if there's no methods, call common one
self::do_field_class_actions( $field, 'save', $new, $old, $post_id );
}

//After save sctions
do_action("rwmb_after_save_post", $post_id);
do_action("rwmb_{$this->meta_box['id']}_after_save_post", $post_id);

//Reinstate save_post action
add_action( 'save_post', array( $this, 'save_post' ) );
}
Expand Down

0 comments on commit 0e488df

Please sign in to comment.