Uses
Uses | Description |
---|---|
wp-includes/post.php: get_post() | Retrieves post data given a post ID or post object. |
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Filters post thumbnail lookup to set the post thumbnail.
(null|array|string) (Required) The value to return
(int) (Required) Post ID.
(string) (Required) Meta key.
(null|array) The default return value or the post thumbnail meta array.
File: wp-includes/revision.php
function _wp_preview_post_thumbnail_filter( $value, $post_id, $meta_key ) { $post = get_post(); if ( ! $post ) { return $value; } 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; } $thumbnail_id = intval( $_REQUEST['_thumbnail_id'] ); if ( $thumbnail_id <= 0 ) { return ''; } return strval( $thumbnail_id ); }
Version | Description |
---|---|
4.6.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_wp_preview_post_thumbnail_filter