Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/wp-admin/post.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@
switch ( $action ) {
case 'post-quickdraft-save':
// Check nonce and capabilities.
$nonce = $_REQUEST['_wpnonce'];
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : '';
$post_id = absint( $_REQUEST['post_ID'] ?? 0 );
$error_msg = false;

// For output of the Quick Draft dashboard widget.
require_once ABSPATH . 'wp-admin/includes/dashboard.php';

if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
if ( ! $post_id || ! wp_verify_nonce( $nonce, 'add-post' ) ) {
$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
}

Expand All @@ -90,7 +91,14 @@
return wp_dashboard_quick_press( $error_msg );
}

$post = get_post( $_REQUEST['post_ID'] );
$post = get_post( $post_id );
if ( ! $post ) {
$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
}

if ( $error_msg ) {
return wp_dashboard_quick_press( $error_msg );
}
check_admin_referer( 'add-' . $post->post_type );

$_POST['comment_status'] = get_default_comment_status( $post->post_type );
Expand Down
Loading