Changeset 38118 for trunk/src/wp-includes/revision.php
- Timestamp:
- 07/20/2016 04:23:36 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/revision.php
r37914 r38118 531 531 532 532 add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 ); 533 add_filter( 'get_post_metadata', '_wp_preview_post_thumbnail_filter', 10, 3 ); 533 534 534 535 return $post; … … 576 577 577 578 return $terms; 579 } 580 581 /** 582 * Filters post thumbnail lookup to set the post thumbnail. 583 * 584 * @since 4.6.0 585 * @access private 586 * 587 * @param null|array|string $value The value to return - a single metadata value, or an array of values. 588 * @param int $post_id Post ID. 589 * @param string $meta_key Meta key. 590 * @return null|array The default return value or the post thumbnail meta array. 591 */ 592 function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { 593 if ( ! $post = get_post() ) { 594 return $value; 595 } 596 597 if ( empty( $_REQUEST['_thumbnail_id'] ) || $post->ID != $post_id || '_thumbnail_id' != $meta_key || 'revision' == $post->post_type ) { 598 return $value; 599 } 600 601 $thumbnail_id = intval( $_REQUEST['_thumbnail_id'] ); 602 if ( $thumbnail_id <= 0 ) { 603 return ''; 604 } 605 606 return strval( $thumbnail_id ); 578 607 } 579 608
Note: See TracChangeset
for help on using the changeset viewer.