From 60b3fe7997d1299b83942c0162020df0483622a3 Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Thu, 29 Jun 2023 17:32:35 +0000 Subject: [PATCH] Media: Fix inconsistent docs for existing `wp_img_tag_add_loading_attr` filter and remove duplicate. Follow-up to [56037]. Props thekt12. See #58235. git-svn-id: https://develop.svn.wordpress.org/trunk@56112 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/deprecated.php | 14 +------------- src/wp-includes/media.php | 5 ++--- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 3a22f77881..8f4396711c 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -4779,19 +4779,7 @@ function wp_img_tag_add_loading_attr( $image, $context ) { return $image; } - /** - * Filters the `loading` attribute value to add to an image. Default `lazy`. - * - * Returning `false` or an empty string will not add the attribute. - * Returning `true` will add the default value. - * - * @since 5.5.0 - * - * @param string|bool $value The `loading` attribute value. Returning a falsey value will result in - * the attribute being omitted for the image. - * @param string $image The HTML `img` tag to be filtered. - * @param string $context Additional context about how the function was called or where the img tag is. - */ + /** This filter is documented in wp-admin/includes/media.php */ $value = apply_filters( 'wp_img_tag_add_loading_attr', $value, $image, $context ); if ( $value ) { diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 6a160ca016..7b323aafac 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -1963,15 +1963,14 @@ function wp_img_tag_add_loading_optimization_attrs( $image, $context ) { if ( empty( $loading_val ) && $loading_attrs_enabled ) { /** * Filters the `loading` attribute value to add to an image. Default `lazy`. - * This filter is added in for backward compatibility. * * Returning `false` or an empty string will not add the attribute. * Returning `true` will add the default value. - * `true` and `false` usage supported for backward compatibility. * * @since 5.5.0 * - * @param string|bool $loading Current value for `loading` attribute for the image. + * @param string|bool $value The `loading` attribute value. Returning a falsey value will result in + * the attribute being omitted for the image. * @param string $image The HTML `img` tag to be filtered. * @param string $context Additional context about how the function was called or where the img tag is. */