From 0569c6219e431f084a4e82f4ea0493e1aa6da0f8 Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Mon, 29 Aug 2016 12:25:29 +0000 Subject: [PATCH] Post Thumbnails: Prevent post thumbnail previews from spilling into other images. After [38118], when previewing a page with a secondary loop, all post thumbnails would be filtered to display the post thumbnail for the page being previewed. This ensures `_wp_preview_post_thumbnail_filter()` is only applied if the `$post_id` of the post meta being filtered is equal to the post or page being previewed. Props swisspidy, joemcgill. Fixes #37697. Built from https://develop.svn.wordpress.org/trunk@38433 git-svn-id: http://core.svn.wordpress.org/trunk@38374 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/revision.php | 8 +++++++- wp-includes/version.php | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/revision.php b/wp-includes/revision.php index b588621944..07a986c003 100644 --- a/wp-includes/revision.php +++ b/wp-includes/revision.php @@ -594,7 +594,13 @@ function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { return $value; } - if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) { + if ( empty( $_REQUEST['_thumbnail_id'] ) || + empty( $_REQUEST['preview_id'] ) || + $post->ID != $post_id || + '_thumbnail_id' != $meta_key || + 'revision' == $post->post_type || + $post_id != $_REQUEST['preview_id'] + ) { return $value; } diff --git a/wp-includes/version.php b/wp-includes/version.php index bd5a8ac3da..afba664ad1 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38432'; +$wp_version = '4.7-alpha-38433'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.