Make WordPress Core


Ignore:
Timestamp:
08/31/2016 06:43:21 PM (8 years ago)
Author:
jeremyfelt
Message:

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.

Merge of [38433] to the 4.6 branch.

Props swissspidy, joemcgill.
Fixes #37697.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/src/wp-includes/revision.php

    r38118 r38476  
    595595    }
    596596
    597     if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) {
     597    if ( empty( $_REQUEST['_thumbnail_id'] ) ||
     598         empty( $_REQUEST['preview_id'] ) ||
     599         $post->ID != $post_id ||
     600         '_thumbnail_id' != $meta_key ||
     601         'revision' == $post->post_type ||
     602         $post_id != $_REQUEST['preview_id']
     603    ) {
    598604        return $value;
    599605    }
Note: See TracChangeset for help on using the changeset viewer.