You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using quick edit to publish a custom post type that uses meta-box, the error message "Are you sure you want to do this?Please try again." is displayed. This is due to the nonce check failing in inc/classes/meta-box.php function "save_post". The check fails because the nonce is not created for inline edits. Not only that, but the fields in memory are not filled in, so the save_post function should not do anything on inline-saves.
The solution is to edit the test in save_post to look like the following:
// Check whether:
// - the post is autosaved
// - the post is a revision
// - current post type is supported
// - user has proper capability
// - the edit is not inline
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 ) )
|| ( $_POST['action'] == 'inline-save' )
)
{
return $post_id;
}
When using quick edit to publish a custom post type that uses meta-box, the error message "Are you sure you want to do this?Please try again." is displayed. This is due to the nonce check failing in inc/classes/meta-box.php function "save_post". The check fails because the nonce is not created for inline edits. Not only that, but the fields in memory are not filled in, so the save_post function should not do anything on inline-saves.
The solution is to edit the test in save_post to look like the following:
// Check whether:
// - the post is autosaved
// - the post is a revision
// - current post type is supported
// - user has proper capability
// - the edit is not inline
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 ) )
|| ( $_POST['action'] == 'inline-save' )
)
{
return $post_id;
}
This thread may explain better:
http://wordpress.org/support/topic/quick-edit-not-working-and-problem-located?replies=4#post-3768402
The text was updated successfully, but these errors were encountered: