Media: Run the `wp_content_img_tag` filter once per image.
Prevent multiple identical `img` tags in a block of content causing the `wp_content_img_tag` filter to fire multiple times for that image. Follow up to [53028]. Props superpoincare, flixos90, pbearne, peterwilsoncc. Fixes #55510. See #55347. Built from https://develop.svn.wordpress.org/trunk@53149 git-svn-id: http://core.svn.wordpress.org/trunk@52738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
561518cdd7
commit
fadb4e1ea3
|
@ -1857,6 +1857,12 @@ function wp_filter_content_tags( $content, $context = null ) {
|
|||
if ( $filtered_image !== $match[0] ) {
|
||||
$content = str_replace( $match[0], $filtered_image, $content );
|
||||
}
|
||||
|
||||
/*
|
||||
* Unset image lookup to not run the same logic again unnecessarily if the same image tag is used more than
|
||||
* once in the same blob of content.
|
||||
*/
|
||||
unset( $images[ $match[0] ] );
|
||||
}
|
||||
|
||||
// Filter an iframe match.
|
||||
|
@ -1871,6 +1877,12 @@ function wp_filter_content_tags( $content, $context = null ) {
|
|||
if ( $filtered_iframe !== $match[0] ) {
|
||||
$content = str_replace( $match[0], $filtered_iframe, $content );
|
||||
}
|
||||
|
||||
/*
|
||||
* Unset iframe lookup to not run the same logic again unnecessarily if the same iframe tag is used more
|
||||
* than once in the same blob of content.
|
||||
*/
|
||||
unset( $iframes[ $match[0] ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-alpha-53148';
|
||||
$wp_version = '6.0-alpha-53149';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue