Update WP and plugins

This commit is contained in:
Oliver Davies 2019-04-16 20:56:22 +01:00
parent 10a4713229
commit 1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions

View file

@ -11,9 +11,9 @@
/**
* Determines whether a post has an image attached.
*
*
* For more information on this and similar theme functions, check out
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* the {@link https://developer.wordpress.org/themes/basics/conditional-tags/
* Conditional Tags} article in the Theme Developer Handbook.
*
* @since 2.9.0
@ -23,7 +23,19 @@
* @return bool Whether the post has an image attached.
*/
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 );
}
/**
@ -76,19 +88,22 @@ function the_post_thumbnail( $size = 'post-thumbnail', $attr = '' ) {
* @param WP_Query $wp_query Optional. A WP_Query instance. Defaults to the $wp_query global.
*/
function update_post_thumbnail_cache( $wp_query = null ) {
if ( ! $wp_query )
if ( ! $wp_query ) {
$wp_query = $GLOBALS['wp_query'];
}
if ( $wp_query->thumbnails_cached )
if ( $wp_query->thumbnails_cached ) {
return;
}
$thumb_ids = array();
foreach ( $wp_query->posts as $post ) {
if ( $id = get_post_thumbnail_id( $post->ID ) )
if ( $id = get_post_thumbnail_id( $post->ID ) ) {
$thumb_ids[] = $id;
}
}
if ( ! empty ( $thumb_ids ) ) {
if ( ! empty( $thumb_ids ) ) {
_prime_post_caches( $thumb_ids, false, true );
}
@ -149,8 +164,9 @@ function get_the_post_thumbnail( $post = null, $size = 'post-thumbnail', $attr =
* and height values (in that order). Default 'post-thumbnail'.
*/
do_action( 'begin_fetch_post_thumbnail_html', $post->ID, $post_thumbnail_id, $size );
if ( in_the_loop() )
if ( in_the_loop() ) {
update_post_thumbnail_cache();
}
$html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr );
/**