Check that `$_POST` array index is set before comparing it in `post_preview()`.

This prevents PHP notices in cases where a user with 'edit_others_posts' but
without 'publish_posts' previews another user's posts.

Props tyxla.
Fixes #31760.

git-svn-id: https://develop.svn.wordpress.org/trunk@31896 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-03-26 01:44:03 +00:00
parent 5d50b55c7e
commit 151520ee02
1 changed files with 1 additions and 1 deletions

View File

@ -1667,7 +1667,7 @@ function post_preview() {
} else {
$is_autosave = true;
if ( 'auto-draft' == $_POST['post_status'] )
if ( isset( $_POST['post_status'] ) && 'auto-draft' == $_POST['post_status'] )
$_POST['post_status'] = 'draft';
$saved_post_id = wp_create_post_autosave( $post->ID );