diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 4e72d1ec3e..adf6b7f2a5 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1674,7 +1674,7 @@ function wp_ajax_image_editor() { } function wp_ajax_set_post_thumbnail() { - $json = ! empty( $_REQUEST['json'] ); + $json = ! empty( $_REQUEST['json'] ); // New-style request $post_ID = intval( $_POST['post_id'] ); if ( !current_user_can( 'edit_post', $post_ID ) ) { @@ -1682,7 +1682,10 @@ function wp_ajax_set_post_thumbnail() { } $thumbnail_id = intval( $_POST['thumbnail_id'] ); - check_ajax_referer( "set_post_thumbnail-$post_ID" ); + if ( $json ) + check_ajax_referer( "update-post_$post_ID" ); + else + check_ajax_referer( "set_post_thumbnail-$post_ID" ); if ( $thumbnail_id == '-1' ) { if ( delete_post_thumbnail( $post_ID ) ) { diff --git a/wp-admin/includes/dashboard.php b/wp-admin/includes/dashboard.php index c4a718e9e0..7414aaf464 100644 --- a/wp-admin/includes/dashboard.php +++ b/wp-admin/includes/dashboard.php @@ -505,6 +505,16 @@ function wp_dashboard_quick_press() { } $post_ID = (int) $post->ID; + + $media_settings = array( + 'id' => $post->ID, + 'nonce' => wp_create_nonce( 'update-post_' . $post->ID ), + ); + + if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' ) ) { + $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true ); + $media_settings['featuredImageId'] = $featured_image_id ? $featured_image_id : -1; + } ?>