wordpress-develop/tests/phpunit/tests/formatting
Felix Arntz 6ff355e87d Media: Fix lazy-loading bug by avoiding to modify content images when creating an excerpt.
The `wp_filter_content_tags()` function, which modifies image tags for example to optimize performance, is hooked into the `the_content` filter by default. When rendering an excerpt for a post that doesn't have a manually provided excerpt, the post content is used to generate the excerpt, handled by the `wp_trim_excerpt()` function.

Prior to this changeset, this led to `wp_filter_content_tags()` being called on the content when generating the excerpt, which is wasteful as all tags are stripped from the excerpt, and it furthermore could result in a lazy-loading bug when the post content contained images, as those images were being counted even though they would never be rendered as part of the excerpt.

This changeset fixes the bug and slightly improves performance for generating an excerpt by temporarily unhooking the `wp_filter_content_tags()` function from the `the_content` filter when using it to generate the excerpt.

Props costdev, flixos90, joemcgill, mukesh27, salvoaranzulla, spacedmonkey, thekt12, westonruter.
Fixes #56588.


git-svn-id: https://develop.svn.wordpress.org/trunk@55850 602fd350-edb4-49c9-b593-d223f7449a82
2023-05-23 18:23:59 +00:00
..
balanceTags.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
capitalPDangit.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
cleanPre.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
convertInvalidEntities.php Build/Test Tools: Fix erroneous file name, from convertInvalidEntries.php to convertInvalidEntities.php. 2022-06-23 20:34:26 +00:00
convertSmilies.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
date.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
emoji.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
ent2ncr.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
escAttr.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
escHtml.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
escJs.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
escTextarea.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
escUrl.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
escXml.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
excerptRemoveBlocks.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
getBloginfo.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
getUrlInContent.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
humanTimeDiff.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
isEmail.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
likeEscape.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
linksAddTarget.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
makeClickable.php Formatting: Restore consistent quotes in _make_web_ftp_clickable_cb(). 2023-03-09 00:18:29 +00:00
mapDeep.php Tests: Replace some occurrences of assertEquals() with assertSame(). 2022-10-07 01:02:07 +00:00
normalizeWhitespace.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
redirect.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
removeAccents.php Formatting: Normalize to Unicode NFC encoding before converting accent characters in remove_accents(). 2022-07-21 21:09:56 +00:00
sanitizeFileName.php Media: Replace consecutive periods in sanitize_file_name(). 2023-02-03 12:46:18 +00:00
sanitizeKey.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
sanitizeLocaleName.php I18N: Introduce sanitization function for locale. 2023-05-16 14:16:39 +00:00
sanitizeMimeType.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
sanitizeOrderby.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
sanitizePost.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
sanitizeTextField.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
sanitizeTitle.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
sanitizeTitleWithDashes.php Formatting: Strip object replacement characters from slugs. 2022-10-11 10:27:00 +00:00
sanitizeTrackbackUrls.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
sanitizeUser.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
seemsUtf8.php Tests: Use the data_ prefix for various data provider methods. 2023-03-19 12:03:30 +00:00
slashit.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
stripslashesDeep.php Coding Standards: Always use parentheses when instantiating an object. 2022-11-29 15:49:49 +00:00
urlencodeDeep.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
urlShorten.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
utf8UriEncode.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpAutop.php Tests: Ignore EOL differences in a wpautop() test for <math> block elements. 2023-03-01 15:56:39 +00:00
wpBasename.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
wpHtmleditPre.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpHtmlExcerpt.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpHtmlSplit.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
wpIsoDescrambler.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpMakeLinkRelative.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpParseStr.php Tests: Improve documentation and variable names in some formatting tests. 2023-03-19 12:51:14 +00:00
wpRelNofollow.php Comments: Improve rel attribute usage in comments. 2023-02-07 18:52:24 +00:00
wpRelUgc.php Comments: Improve rel attribute usage in comments. 2023-02-07 18:52:24 +00:00
wpReplaceInHtmlTags.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpRicheditPre.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpSlash.php Coding Standards: Always use parentheses when instantiating an object. 2022-11-29 15:49:49 +00:00
wpSpecialchars.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
wpStripAllTags.php Formatting: Guard wp_strip_all_tags() against fatal errors. 2023-02-07 03:32:43 +00:00
wpTargetedLinkRel.php Tests: Correctly use the factory method. 2022-09-06 22:03:10 +00:00
wpTexturize.php Tests: Move some @covers tags in the formatting group to the class DocBlock. 2022-10-31 13:54:00 +00:00
wpTrimExcerpt.php Media: Fix lazy-loading bug by avoiding to modify content images when creating an excerpt. 2023-05-23 18:23:59 +00:00
wpTrimWords.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00
zeroise.php Build/Test Tools, Formatting group: 2022-06-23 20:27:34 +00:00