By skipping iterations in block supports when not necessary, this changeset improves performance of the function notably.
The performance enhancement leads to even a notable improvement for overall page load time: For example, the Twenty Twenty-Four home page loads ~2% faster with this changeset.
Props dmsnell, spacedmonkey, costdev, hellofromTonya, aaronrobertshaw.
Fixes#59544.
git-svn-id: https://develop.svn.wordpress.org/trunk@56807 602fd350-edb4-49c9-b593-d223f7449a82
Prior to this changeset, `get_hooked_blocks` was called four times ''for every parsed block'' in each template, template part, and pattern. With this changeset applied, `get_hooked_blocks` is called only once per template, template part, or pattern.
Additionally, `get_hooked_blocks` is called only once when returning the list of all registered patterns. (The latter modification brings the implementation closer to its state prior to Block Hooks.)
Finally, when there are no registered hooked blocks or `hooked_block_types` filters, parsing, hooked block insertion, and re-serializing is skipped altogether.
Props gziolo, flixos90, joemcgill, dmsnell, spacedmonkey, hellofromtonya.
Fixes#59383.
git-svn-id: https://develop.svn.wordpress.org/trunk@56805 602fd350-edb4-49c9-b593-d223f7449a82
Exit early when parsing Application Password credentials if Authorization header value does not contain at least one colon. The `Authorization` Basic header must use a colon to separate the username and password components per RFC 7617, so a username-only string is malformed and should not be processed.
Split `Authorization` header only on the first colon, properly handling passwords containing colons.
Resolves PHP 8.0 warning when `list()` was called on an exploded credentials array containing only one element.
Props kalpeshh, shooper, sc0ttkclark, jrf, mukesh27, oglekler, nicolefurlan.
Fixes#57512.
git-svn-id: https://develop.svn.wordpress.org/trunk@56804 602fd350-edb4-49c9-b593-d223f7449a82
Follow up to [56022] to fix inability to set a date/time in quick editing. Allow a user to set a quick/edit date while preventing accidental date assignments per the original intent.
Props tristanleboss, ivanzhuck, tibbsa, sabernhardt, sergeybiryukov, oandregal, khokansardar, joedolson, shailu25.
Fixes#59125. See #19907.
git-svn-id: https://develop.svn.wordpress.org/trunk@56802 602fd350-edb4-49c9-b593-d223f7449a82
Add `display: flex` to `.copy-to-clipboard-container` to fix alignment of elements within the container.
Props sujichandran14, oglekler, sarathar, huzaifaalmesbah, nicolefurlan, joemcgill, dkotter.
Fixes#58829.
git-svn-id: https://develop.svn.wordpress.org/trunk@56801 602fd350-edb4-49c9-b593-d223f7449a82
Restore missing space in two admin notices during theme activation.
Props shailu25, sergeybiryukov, mukesh27, hellofromtonya.
Fixes#59501. See #57791.
git-svn-id: https://develop.svn.wordpress.org/trunk@56800 602fd350-edb4-49c9-b593-d223f7449a82
In WordPressCS 3.0.0, the functionality of the `WordPress.Security.EscapeOutput` sniff was updated to report unescaped message parameters passed to exceptions created in `throw` statements. This specific violation now has a separate error code: `ExceptionNotEscaped`. This will allow users to ignore or exclude that specific error code.
The error code(s) for other escaping issues flagged by the sniff remain unchanged.
References:
* [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.1 WPCS 3.0.1 release notes]
* [https://github.com/WordPress/WordPress-Coding-Standards/compare/3.0.0...3.0.1 Full list of changes in WPCS 3.0.1]
Follow-up to [56695].
Props jrf, bjorsch, dawidurbanski.
See #59161.
git-svn-id: https://develop.svn.wordpress.org/trunk@56799 602fd350-edb4-49c9-b593-d223f7449a82
This resolves a WPCS warning:
{{{
Array double arrow not aligned correctly;
expected 1 space(s) between "'type'" and double arrow, but found 15.
}}}
Follow-up to [56570], [56680].
Props jrf.
See #59161, #58831.
git-svn-id: https://develop.svn.wordpress.org/trunk@56798 602fd350-edb4-49c9-b593-d223f7449a82
Having those tests in `trunk` already will help ensure potential future fixes to this logic maintain backward compatibility.
Props mukesh27, spacedmonkey.
See #59360.
git-svn-id: https://develop.svn.wordpress.org/trunk@56797 602fd350-edb4-49c9-b593-d223f7449a82
When using the `$autoload` parameter of `update_option()` alongside an option value update, prior to this changeset the function would update the incorrect cache, not respecting the new autoload value. This could have severe implications such as returning a stale option value when the option in fact had already been deleted.
This changeset fixes the bug alongside test coverage that failed with `trunk` but now passes.
Props kkmuffme, pentatonicfunk, SergeyBiryukov, oglekler, azaozz, spacedmonkey, nicolefurlan, joemcgill, flixos90.
Fixes#51352.
git-svn-id: https://develop.svn.wordpress.org/trunk@56796 602fd350-edb4-49c9-b593-d223f7449a82
This aims to better align the navigation fallback implementation with core architecture and best practices.
The function that updates the `wp_navigation` post response schema is now a public method of the `WP_Navigation_Fallback` class, so an extra file previously used for that specific function is no longer necessary.
Follow-up to [56052].
Props ramonopoly, scruffian, isabel_brison, mukesh27, swissspidy, rajinsharwar, afercia, audrasjb, mikeschroder, JeffPaul, johnjamesjacoby, TimothyBlynJacobs, oglekler, SergeyBiryukov.
Fixes#58910.
git-svn-id: https://develop.svn.wordpress.org/trunk@56793 602fd350-edb4-49c9-b593-d223f7449a82
Because the contents of binary files are not included in patches by default, occasionally empty versions of these files are committed on accident. This is the most commonly happens within default themes because they usually contain image and font files.
This adds a job to the theme related GitHub Action workflow that checks for the presence of zero-byte files so that these instances are caught more easily.
Props costdev, hellofromTonya, luminuu, onemaggie.
Fixes#59527.
git-svn-id: https://develop.svn.wordpress.org/trunk@56792 602fd350-edb4-49c9-b593-d223f7449a82
`WP_HTML_Processor::create_fragment()` is the correct method name as per the WordPress PHP coding standards.
Follow-up to [56274].
Props dmsnell, jrf, hellofromTonya, SergeyBiryukov.
Fixes#59547.
git-svn-id: https://develop.svn.wordpress.org/trunk@56790 602fd350-edb4-49c9-b593-d223f7449a82
When calling `update_option()` with value `false` on a non-existent option, prior to [56681] the function would have returned `false` and not stored the value in the database, since the given value was the same as the default.
The aforementioned changeset broke that promise with good intention, however this particular change was a backward compatibility break and therefore is resolved here.
Props mukesh27, costdev.
Fixes#22192.
git-svn-id: https://develop.svn.wordpress.org/trunk@56788 602fd350-edb4-49c9-b593-d223f7449a82
This is a follow-up to [56528], which normalizes the `BLOCKS_PATH` for Windows prior to making paths relative for caches during the registration process. Prior to this change, incorrect file paths would lead to broken styles for core blocks on Windows.
Props wildworks, pbiron, flixos90, joemcgill.
Fixes#59489. See #59111.
git-svn-id: https://develop.svn.wordpress.org/trunk@56785 602fd350-edb4-49c9-b593-d223f7449a82
This changeset:
- Replaces `body` with `html` for the first CSS selector that makes text white against a dark background
- Moves `twentytwenty_block_editor_styles()` from the `enqueue_block_editor_assets` action to `enqueue_block_assets` for WordPress 6.3 and later
- Removes the obsolete `twentytwenty-block-editor-script` from the styles function to avoid an error in the iframe
Props floydwilde, poena, huzaifaalmesbah, greenshady, sabernhardt, audrasjb, pooja1210, shailu25, joemcgill.
Fixes#59086.
git-svn-id: https://develop.svn.wordpress.org/trunk@56783 602fd350-edb4-49c9-b593-d223f7449a82
After [53947], all workflows will automatically be restarted once in an attempt to rule out reasons for failures, such as timeouts or network hiccups.
Second attempt at [56404], which was previously reverted in [56407].
See #58867.
git-svn-id: https://develop.svn.wordpress.org/trunk@56780 602fd350-edb4-49c9-b593-d223f7449a82
Add in missing since PHPDoc block for `_prime_post_parents_caches` function added in [56763].
Props mukesh27.
See #59188
git-svn-id: https://develop.svn.wordpress.org/trunk@56773 602fd350-edb4-49c9-b593-d223f7449a82
This adds Twenty Twenty-Four to the Default Theme test workflow in GitHub Actions.
Follow up to [56764], [56726], [56721], [56716].
See #59447.
git-svn-id: https://develop.svn.wordpress.org/trunk@56770 602fd350-edb4-49c9-b593-d223f7449a82
Includes:
* Expanding and synchronizing documentation for the `default` and `rating` arguments.
* Adding `@since` entries for the `loading`, `fetchpriority`, and `decoding` arguments.
* Wrapping long lines as per the documentation standards.
* Fixing a typo in the `identicon` value.
* Minor formatting edits for consistency.
Follow-up to [31107], [45632], [47554], [53480], [56037].
See #58833.
git-svn-id: https://develop.svn.wordpress.org/trunk@56767 602fd350-edb4-49c9-b593-d223f7449a82
Removes an extraneous line break in the `_prime_post_parents_caches()` tests.
Follow-up to [56763].
Unprops spacedmonkey.
Props mukesh27, costdev.
See #59188.
git-svn-id: https://develop.svn.wordpress.org/trunk@56766 602fd350-edb4-49c9-b593-d223f7449a82
The `_register_theme_block_patterns` function imposed a significant resource overhead. This issue primarily stems from themes, such as TT4, that register a substantial number of block patterns. These patterns necessitate numerous file operations, including file lookups, file reading into memory, and related processes. To provide an overview, the _register_theme_block_patterns function performed the following file operations:
- is_dir
- is_readable
- file_exists
- glob
- file_get_contents (utilized via get_file_data)
To address these issues, caching using a transient has been added to a new function call `_wp_get_block_patterns`. If theme development mode is disabled and theme exists, the block patterns are saved in a transient cache. This cache is used all requests after that, saving file lookups and reading files into memory. Cache invalidation is done, when themes are switched, deleted or updated. Meaning that block patterns are not stored in the cache incorrectly.
Props flixos90, joemcgill, peterwilsoncc, costdev, swissspidy, aristath, westonruter, spacedmonkey.
Fixes#59490
git-svn-id: https://develop.svn.wordpress.org/trunk@56765 602fd350-edb4-49c9-b593-d223f7449a82
Twenty Twenty-Four (TT4) updates for 6.4 Beta 2.
Changes include bugfixes from the theme's development repo since Beta 1 such as:
* Renamed patterns and images
* Improved image descriptions
* Polished a few of the templates to fit better the design
* Addressed some a11y concerns.
* Changed the required version to 6.4, aligning it with the last few default themes since we are making use of some of the features that will make it to 6.4, such as aspect ratio.
Follow-up to [56726], [56721], [56716].
Props onemaggie, desrosj, mukesh27.
Fixes#59524.
git-svn-id: https://develop.svn.wordpress.org/trunk@56764 602fd350-edb4-49c9-b593-d223f7449a82
In [53941], the addition of query caching to `WP_Query` brought about an unintended issue when querying for fields equal to id=>parent. Specifically, on websites with object caching enabled and a substantial number of pages, the second run of this query triggered the `_prime_post_caches` function for id=>parent. This led to the unnecessary priming of post, meta, and term caches, even when only id and parent information were requested.
This commit addresses this issue by introducing a new function, `_prime_post_parents_caches`, which primes a dedicated cache for post parents. This cache is primed during the initial query execution. Subsequently, the `wp_cache_get_multiple` function is employed to retrieve all post parent data in a single object cache request, optimizing performance.
Additionally, this commit extends the coverage of existing unit tests to ensure the reliability of the changes.
Props kevinfodness, joemcgill, peterwilsoncc, LinSoftware, thekt12, spacedmonkey.
Fixes#59188
git-svn-id: https://develop.svn.wordpress.org/trunk@56763 602fd350-edb4-49c9-b593-d223f7449a82
As a follow up to [56681], this changeset adds further tests, primarily focused on ensuring no unnecessary database queries are run.
Props mukesh27, costdev, joemcgill, spacedmonkey.
See #22192.
git-svn-id: https://develop.svn.wordpress.org/trunk@56762 602fd350-edb4-49c9-b593-d223f7449a82
Adds a simplified version of Twenty Twenty-Three theme that helps testing Block Hooks integration. The theme contains:
- The required index.html template.
- The optional single.html template used with tests.
- 3 template parts where two of them reference patterns.
- 3 patterns referenced in the templates and the template parts.
New tests automatically register 4 custom blocks with the test theme where each of them hooks into another block using all four target relative positions: `before`, `after`, `firstChild`, `lastChild`.
The tests verify that the block gets hooked into the correct positions when targeting:
- template
- template part
- pattern
Props ockham, costdev.
See #59313, #59383.
Follow-up [56610].
git-svn-id: https://develop.svn.wordpress.org/trunk@56759 602fd350-edb4-49c9-b593-d223f7449a82
Transforms `initialize_theme_preview_hooks` to `wp_initialize_theme_preview_hooks` to avoid conflicts with third-party code.
Follow up to [56529].
Props okat.
See #59000.
git-svn-id: https://develop.svn.wordpress.org/trunk@56757 602fd350-edb4-49c9-b593-d223f7449a82
The `VariableAnalysis` standard is not used by WP Core.
Follow-up to [50958], [51003], [52049], [52051], [52069], [53072], [54132], [55132], [56363], [56738], [56743], [56751], [56752].
Props jrf.
See #59161.
git-svn-id: https://develop.svn.wordpress.org/trunk@56753 602fd350-edb4-49c9-b593-d223f7449a82
This removes ignore annotations related to sniffs which are not used by WP Core (like sniffs in the `WordPress-Extra` ruleset).
Follow-up to [48072], [51003], [55204], [56714].
Props jrf.
See #59161.
git-svn-id: https://develop.svn.wordpress.org/trunk@56752 602fd350-edb4-49c9-b593-d223f7449a82
This removes ignore annotations about invalid function names for deprecated functions. Those are ignored by design in WPCS since version 2.2.0.
Follow-up to [45580], [47612], [47927].
Props jrf.
See #59161.
git-svn-id: https://develop.svn.wordpress.org/trunk@56751 602fd350-edb4-49c9-b593-d223f7449a82
This was causing a `_doing_it_wrong()` notice from `wp_remove_surrounding_empty_script_tags()`. In fact, the `type` attribute was added in [56748] to test this incorrect usage notice. This commit reverts that change.
Follow-up to [56748].
Unprops westonruter.
See #58664.
git-svn-id: https://develop.svn.wordpress.org/trunk@56750 602fd350-edb4-49c9-b593-d223f7449a82
Since IE11 is no longer supported, the `URL` and `URLSearchParams` APIs can now be leveraged for simpler and more robust URL manipulation. This was done similarly in [56383] for `embed.js`.
Props nicolefurlan, dmsnell, westonruter.
Fixes#59480.
git-svn-id: https://develop.svn.wordpress.org/trunk@56749 602fd350-edb4-49c9-b593-d223f7449a82
* Add `wp_remove_surrounding_empty_script_tags()` to more precisely remove script tag wrappers and warn when doing it wrong.
* Add clarifying comments for XML escaping logic in `wp_get_inline_script_tag()`.
* Leverage `WP_HTML_Tag_Processor` in `test_remove_frameless_preview_messenger_channel`.
* Reuse `assertEqualMarkup` in `test_blocking_dependent_with_delayed_dependency`.
* Normalize whitespace in `parse_markup_fragment` for `assertEqualMarkup`.
Follow-up to [56687].
Props dmsnell, westonruter, flixos90.
See #58664.
git-svn-id: https://develop.svn.wordpress.org/trunk@56748 602fd350-edb4-49c9-b593-d223f7449a82
In cases where `WP_Comment_Query` or `get_comments` is employed with the 'count' parameter set to true, specify 'order by' as 'none'. Since these queries serve solely to determine the count of comments matching specific query parameters, the 'order by' clause becomes redundant and places unnecessary strain on the database server, resulting in slower query execution. Given that count queries are executed on every admin request to retrieve comment counts, this change enhances the performance of the wp-admin interface.
Props guss77, davidbaumwald, SergeyBiryukov, westonruter, peterwilsoncc, foliovision, hareesh-pillai, spacedmonkey.
Fixes#58368
git-svn-id: https://develop.svn.wordpress.org/trunk@56747 602fd350-edb4-49c9-b593-d223f7449a82