Media: Introduce the `has_post_thumbnail` filter.
Props rzen, desrosj. Fixes #44859. Built from https://develop.svn.wordpress.org/trunk@44542 git-svn-id: http://core.svn.wordpress.org/trunk@44373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f251342de7
commit
ae5c195d57
|
@ -23,7 +23,19 @@
|
||||||
* @return bool Whether the post has an image attached.
|
* @return bool Whether the post has an image attached.
|
||||||
*/
|
*/
|
||||||
function has_post_thumbnail( $post = null ) {
|
function has_post_thumbnail( $post = null ) {
|
||||||
return (bool) get_post_thumbnail_id( $post );
|
$thumbnail_id = get_post_thumbnail_id( $post );
|
||||||
|
$has_thumbnail = (bool) $thumbnail_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filters whether a post has a post thumbnail.
|
||||||
|
*
|
||||||
|
* @since 5.1.0
|
||||||
|
*
|
||||||
|
* @param bool $has_thumbnail true if the post has a post thumbnail, otherwise false.
|
||||||
|
* @param int|WP_Post|null $post Post ID or WP_Post object. Default is global `$post`.
|
||||||
|
* @param int|string $thumbnail_id Post thumbnail ID or empty string.
|
||||||
|
*/
|
||||||
|
return (bool) apply_filters( 'has_post_thumbnail', $has_thumbnail, $post, $thumbnail_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.1-alpha-44541';
|
$wp_version = '5.1-alpha-44542';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue