Commit Graph

22060 Commits

Author SHA1 Message Date
desrosj
d9f4318a56 Docs: Correct typo in new @since tag.
Follow up to [56635], [56641].

See #18298.
Built from https://develop.svn.wordpress.org/trunk@56679


git-svn-id: http://core.svn.wordpress.org/trunk@56191 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 15:18:22 +00:00
spacedmonkey
ffad402ba3 Themes: Use instanceof in block_has_support.
In [50761], the block_has_support function was introduced. However, using `property_exists` within this function negatively impacted its performance. This commit replaces the `property_exists` function call with `instanceof WP_Block_Type`, resulting in improved performance.

Props mukesh27, gziolo, spacedmonkey.
Fixes #59441.
Built from https://develop.svn.wordpress.org/trunk@56678


git-svn-id: http://core.svn.wordpress.org/trunk@56190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 12:17:23 +00:00
spacedmonkey
73c8507a84 Themes: Use instanceof in get_hooked_blocks.
In [56610], the get_hooked_blocks function was introduced. However, using property_exists within this function negatively impacted its performance. This commit replaces the property_exists function call with instanceof WP_Block_Type, resulting in improved performance.

Props gziolo, spacedmonkey.
See #59383.
Built from https://develop.svn.wordpress.org/trunk@56677


git-svn-id: http://core.svn.wordpress.org/trunk@56189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 11:48:17 +00:00
gziolo
158f4a8fcc REST API: Improve the block type schema for the name field
Align the schema between `block.json` defined in Gutenberg and the REST API endpoint for block types. It looks like the `name` field isn't validated in all places and when it uses pattern matching in the REST API code, then it was slightly different.

Props spacedmonkey, ockham.
See #59346.


Built from https://develop.svn.wordpress.org/trunk@56676


git-svn-id: http://core.svn.wordpress.org/trunk@56188 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 10:03:38 +00:00
Andrea Fercia
97b85f2823 Editor: Add missing parameter to the block_editor_no_javascript_message filter after [56672].
Props mukesh27.

Fixes #59229.

Built from https://develop.svn.wordpress.org/trunk@56675


git-svn-id: http://core.svn.wordpress.org/trunk@56187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 10:02:22 +00:00
Bernhard Reiter
9fd898a7c7 Blocks: Remove inject_hooked_block_markup filter.
Per discussion in #59424, there's agreement that the new `hooked_block_types` filter  (introduced in [56673]) covers conditional addition and removal of hooked blocks better and at a higher level than the `inject_hooked_block_markup` filter that was originally added in [56649] for that same purpose.
Consequently, this changeset removes the latter filter.

Props gziolo.
Fixes #59439.
Built from https://develop.svn.wordpress.org/trunk@56674


git-svn-id: http://core.svn.wordpress.org/trunk@56186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 09:14:17 +00:00
Bernhard Reiter
ffb8b43072 Blocks: Introduce filter to allow easy addition of hooked blocks.
Introduce a `hooked_block_types` filter that allows easier conditional addition (or removal) of hooked blocks for a given anchor block and relative position.

{{{#!php
function insert_shopping_cart_hooked_block( $hooked_blocks, $position, $anchor_block, $context ) {
	if ( 'after' === $position && 'core/navigation' === $anchor_block && /** $context is header template part **/ ) {
		$hooked_blocks[] = 'mycommerce/shopping-cart';
	}
	return $hooked_blocks;
}
add_filter( 'hooked_block_types', 'insert_shopping_cart_hooked_block', 10, 4 );
}}}

Props gziolo, nerrad, dmsnell, ndiego.
Fixes #59424.
Built from https://develop.svn.wordpress.org/trunk@56673


git-svn-id: http://core.svn.wordpress.org/trunk@56185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 08:44:22 +00:00
joedolson
8663e65bde Editor: Improve no JS message for block editor.
Show the user a link to install the classic editor if they do not have JavaScript available and the plugin is not already installed.

Props bosskhj, audrasjb, huzaifaalmesbah, sajjad67, joedolson, costdev.
Fixes #59229.
Built from https://develop.svn.wordpress.org/trunk@56672


git-svn-id: http://core.svn.wordpress.org/trunk@56184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 00:07:21 +00:00
joedolson
8743d1318c Widgets: Add missing no JS notice in Widgets screen.
Add an H1 heading and an admin notice to display on the Widgets screen when JS is not available. Invite the user to either install or activate the Classic Widgets plugin, as that plugin provides basic functionality without JS.

Props afercia, nihar007, huzaifaalmesbah, joedolson, matthewfarlymn, bvreeman22, bosskhj, devmuhib, shailu25, joedolson.
Fixes #58738.
Built from https://develop.svn.wordpress.org/trunk@56671


git-svn-id: http://core.svn.wordpress.org/trunk@56183 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 00:00:17 +00:00
joedolson
223b713734 Site Health: Improve wp.a11y.speak() notifications.
Improve the experience for screen reader users by removing announcements produced in the Dashboard, simplifying the text to reduce verbosity, and ensuring that messages are spoken in the correct order to match the state of the user interface without repetition.

Props afercia, alexstine.
Fixes #58573.
Built from https://develop.svn.wordpress.org/trunk@56670


git-svn-id: http://core.svn.wordpress.org/trunk@56182 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-24 20:13:21 +00:00
Sergey Biryukov
86c9da14e3 Build/Test Tools: Remove random_compat from PHPCS and PHPUnit configuration files.
This package was removed in WP 6.3, so these exclusion entries are no longer necessary.

Follow-up to [42346], [42665], [49797], [56141], [56667].

See #58831, #58955.
Built from https://develop.svn.wordpress.org/trunk@56669


git-svn-id: http://core.svn.wordpress.org/trunk@56181 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-24 07:45:25 +00:00
costdev
464026afbc REST API: Correct spelling error in block_hooks field documentation.
In [56587], a spelling error was introduced in the documentation of the new `block_hooks` field in `WP_REST_Block_Types_Controller`.

This fixes the spelling error.

Follow-up to [56587].

Props kebbet, mukesh27, tahmina1du.
Fixes #59426. See #59346.
Built from https://develop.svn.wordpress.org/trunk@56668


git-svn-id: http://core.svn.wordpress.org/trunk@56180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-23 15:37:22 +00:00
Sergey Biryukov
db00a83b39 Coding Standards: Remove unnecessary directives in the PHPCompatibility ruleset.
This commit:

* Removes the unnecessary exclusion patterns for the `node_modules` and `vendor` directories. As this ruleset only scans the `src` directory, those directories would never be scanned anyway.
* Removes the selective excludes related to the random_compat package. This package was removed in WP 6.3, so these excludes are no longer necessary.

Follow-up to [46290], [56141].

Props jrf.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56667


git-svn-id: http://core.svn.wordpress.org/trunk@56179 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-23 11:07:19 +00:00
Sergey Biryukov
bc9dc31200 Coding Standards: Improve organization of the PHPCompatibility ruleset.
This commit:
* Adds section headers to the ruleset file.
* Organizes all directives in their respective sections.

No functional changes.

Props jrf.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56666


git-svn-id: http://core.svn.wordpress.org/trunk@56178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-23 10:58:23 +00:00
joedolson
5d6106539e Administration: Switch order of label/checkbox in WP_List_Table.
Move the label after the checkbox in `WP_List_Table` instances. Resolve a false positive that will be presented by automated accessibility testing tools. Follow up to [55954].

Props dimitrism, joedolson, sabernhardt, oglekler, marybaum, tobiasbg.
Fixes #58703.
Built from https://develop.svn.wordpress.org/trunk@56665


git-svn-id: http://core.svn.wordpress.org/trunk@56177 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 19:58:16 +00:00
Adam Silverstein
77582c4be9 Security: remove the cron event that checked for https support.
Fix an issue where a cron job ran every 12 hours to check for https support - even when https support was already enabled. The check is now run only when the user visits the Site Health page. Reducing the unneeded requests lowers the impact and load of hosting WordPress sites.

The `wp_update_https_detection_errors` function is deprecated and the `https_detection_errors` option that was previously set by the cron job is no longer maintained. The `pre_wp_update_https_detection_errors` filter is deprecated and replaced by the `pre_wp_get_https_detection_errors` filter  which serves the same function.

Props audrasjb, johnbillion, Michi91.
Fixes #58494.


Built from https://develop.svn.wordpress.org/trunk@56664


git-svn-id: http://core.svn.wordpress.org/trunk@56176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 19:08:19 +00:00
joedolson
61ed1cb48e Administration: Remove duplicate wp_admin_notice() call.
Remove duplicate success message displayed in `wp-admin/upload.php`. Follow up to [56573].

Props davidbinda.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56663


git-svn-id: http://core.svn.wordpress.org/trunk@56175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 18:19:19 +00:00
joedolson
4b17383d2c Code Modernization: Rename reserved keyword used as variable.
Change the `$echo` parameter added to `wp_update_php_annnotation()` to `$display` to avoid using reserved PHP keywords as parameters. Follow up to [56570].

Props kebbet, mukesh27.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56662


git-svn-id: http://core.svn.wordpress.org/trunk@56174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 18:14:16 +00:00
desrosj
da9f594a55 Build/Test Tools: Introduce install and upgrade testing workflows.
This introduces GitHub Action workflows for testing the installation and upgrade process to ensure there are no unexpected issues. The goal of these workflows is to replicate some of the manual testing that happens during the release process. This does not replace that testing which is a fantastic, low barrier way for someone newer to contributing to get involved. Instead, it should serve as an additional sanity check to ensure no combinations are missed.

The installation workflow tests installing the latest or specified version of WordPress on all PHP and MySQL version combinations for both single and multisite.

The upgrade testing will test upgrading from each branch that still receives security updates to the latest or specified version on all PHP and MySQL version combinations for both single and multisite.

Both workflows confirm that no errors are encountered when using WP-CLI to install or upgrade WordPress. No test assertions of any type are currently performed, but adding some will be explored.

Props costdev, azaozz, ironprogrammer, desrosj.
See #58977.
Built from https://develop.svn.wordpress.org/trunk@56661


git-svn-id: http://core.svn.wordpress.org/trunk@56173 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 17:43:21 +00:00
desrosj
e3954daefa Build/Test Tools: Simplify some logic in GitHub Action workflows.
This simplifies the logic within the `slack-notifications` and `failed-workflow` steps in GitHub Action workflows to use the `contains()` function and object filtering.

This makes it simpler to perform the needed checks by removing the need to list out every single dependent job defined in `needs`.

See #58867.
Built from https://develop.svn.wordpress.org/trunk@56660


git-svn-id: http://core.svn.wordpress.org/trunk@56172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 14:29:17 +00:00
desrosj
ecf275f1c3 Build/Test Tools: Update the environment variable for skipping browser binaries.
This changes the environment variable used in GitHub Action workflows to skip downloading the browser binary that’s a peer dependency when it’s not needed.

In [56647], the version of `puppeteer` peer-dependency was bumped to `>= 20.0.0`. Starting in version `20.0.0`, puppeteer switched to using Chrome for testing instead of Chromium. With this release, the `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` environment variable was removed in favor of the more generic `PUPPETEER_SKIP_DOWNLOAD`.

All workflows that do not need a browser binary now contain the correct `PUPPETEER_SKIP_CHROMIUM_DOWNLOAD` variable.

Follow up to [56647].

See #58863.
Built from https://develop.svn.wordpress.org/trunk@56659


git-svn-id: http://core.svn.wordpress.org/trunk@56171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 13:57:18 +00:00
Sergey Biryukov
2d7e5afa3e Media: Use correct option name for attachment pages in upgrade_640().
Follow-up to [56657].

See #57913.
Built from https://develop.svn.wordpress.org/trunk@56658


git-svn-id: http://core.svn.wordpress.org/trunk@56170 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 01:18:18 +00:00
Sergey Biryukov
229d32f6d7 Media: Disable attachment pages for new installations.
WordPress creates attachment pages by default for every attachment uploaded. On the vast majority of sites, these attachment pages don't contain any meaningful information. They do however exist, get indexed by search engines, and sometimes even rank in search results, leading to bad results for users and site owners.

This commit introduces a `wp_attachment_pages_enabled` database option to control the attachment pages behavior:

* On existing sites, the option is set to `1` on upgrade, so that attachment pages continue to work as is.
* For new sites, the option is set to to `0` by default, which means attachment pages are redirected to the attachment URL.
* Sites that want to enable or disable the attachment pages can set the option to `1` or `0`, respectively.

Follow-up to [2958], [3303], [7149], [34690].

Props aristath, poena, afercia, joostdevalk, jonoaldersonwp, azaozz, johnbillion, joedolson, basiliskan, audrasjb, davelo, rilwis, manfcarlo, tyxla, garrett-eclipse, seedsca, eatingrules, matveb, antpb, zodiac1978, oglekler, zunaid321, costdev, SergeyBiryukov.
Fixes #57913.
Built from https://develop.svn.wordpress.org/trunk@56657


git-svn-id: http://core.svn.wordpress.org/trunk@56169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-22 00:04:41 +00:00
spacedmonkey
d211ad45b1 Query: Improved handling of filtered queries in WP_Query.
The `WP_Query` class enables developers to customize queries using filters like `posts_fields_request`, `posts_request`, and `the_posts`, which can modify both the queried fields and retrieved post objects. In some cases with these filters, incomplete or invalid post objects lacking essential data may arise. To address this, if any of these filters are active during a query, the `get_posts` method now avoids caching post objects with the usual `update_post_caches` function call, opting for a call to `_prime_post_caches` instead. This may occasionally trigger new database queries to prime the post data cache. While this enhancement may result in rare additional database queries, it ensures that invalid post objects aren't cached, prioritizing data consistency and integrity in filtered query scenarios.

Props saulirajala, spacedmonkey, flixos90, mukesh27, peterwilsoncc.
Fixes #58599.
Built from https://develop.svn.wordpress.org/trunk@56656


git-svn-id: http://core.svn.wordpress.org/trunk@56168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 19:34:18 +00:00
desrosj
ced31b7c58 HTTP API: Deprecate WP_Http_Curl and WP_Http_Streams classes.
These classes have not been used in WordPress Core since the Requests library was introduced in [37428]. These classes are now deprecated in favor of `WP_Http`.

There are two remaining spots in Core that reference these classes:
- The `WP_Http::_dispatch_request()` method, which was marked as deprecated in favor of `WP_Http::request()` in [42766]/[44346].
- The `WP_Http::_get_first_available_transport()`.

That latter is now also marked as deprecated in favor of `\WpOrg\Requests\Requests::get_transport_class()`.

Props SergeyBiryukov, rajinsharwar, hellofromTonya.
Fixes #58705.
Built from https://develop.svn.wordpress.org/trunk@56655


git-svn-id: http://core.svn.wordpress.org/trunk@56167 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 18:29:12 +00:00
joedolson
491a21da64 Login and Registration: Improve HTML for errors and notices.
Improve markup on Login and Registration errors. Use list markup for multiple issues, paragraph when only one to reduce semantic burden in the most common case. Normalize classes and markup for wrapper using `wp_admin_notice()` and `wp_get_admin_notice()` functions. Move definition of those functions from `wp-admin\includes\misc.php` to `wp-includes\functions.php`. Move tests to functions group. 

Props extendwings, sabernhardt, afercia, lukecavanagh, rianrietveld, oglekler, sergeybiryukov, costdev, joedolson.
Fixes #30685.
Built from https://develop.svn.wordpress.org/trunk@56654


git-svn-id: http://core.svn.wordpress.org/trunk@56166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 18:24:15 +00:00
joedolson
198543cf2f Coding Standards: Remove unused variable el in monitorPopup.
Remove an unused variable to resolves coding standards failure. Follow up to [56651].

Props joedolson.
See #58756.
Built from https://develop.svn.wordpress.org/trunk@56653


git-svn-id: http://core.svn.wordpress.org/trunk@56165 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 18:04:16 +00:00
joedolson
665928659b Media: Close image rotation menu when not focused.
Implement a focus monitor so that if user focus moves away from the image rotation menu, it closes and doesn't block the image editing canvas. Follow up to [56239], [55919].

Props nithi22, deepakvijayan, dharm1025, faisal03.
Fixes #58756.
Built from https://develop.svn.wordpress.org/trunk@56652


git-svn-id: http://core.svn.wordpress.org/trunk@56164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 17:49:18 +00:00
Felix Arntz
cd11ddbac1 Media: Introduce filters to customize the results from wp_get_loading_optimization_attributes().
This changeset introduces two filters that allow customizing the loading optimization attributes array returned from `wp_get_loading_optimization_attributes()` for individual HTML tags:
* The `wp_get_loading_optimization_attributes` filter can be used to modify the results from the WordPress core logic.
* The `pre_wp_get_loading_optimization_attributes` filter can be used to use entirely custom logic and effectively short-circuit the core function.

Props pereirinha, mukesh27, spacedmonkey, joemcgill.
Fixes #58893.

Built from https://develop.svn.wordpress.org/trunk@56651


git-svn-id: http://core.svn.wordpress.org/trunk@56163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 16:38:15 +00:00
spacedmonkey
c4c54f035c Taxonomy: Stop double sanitization in get_term function.
In the `get_term` function, the filter method is invoked on the `WP_Term` object, which subsequently triggers the execution of `sanitize_term`. The filter method is also executed within `WP_Term::get_instance`.

A common scenario when calling the `get_term` function is to invoke the function with an integer ID for the term and a filter set to "raw." This results in a call to `WP_Term::get_instance`. However, since both `get_term` and `WP_Term::get_instance` invoke the filter method, it leads to double sanitization of the term.

Considering that `get_term` may be called thousands of times on a page, especially when priming a large number of terms into memory, this redundancy can result in thousands of unnecessary calls to `sanitize_term`. Performing the same sanitization operation twice with the same parameters is wasteful and detrimental to performance.

To address this issue, the code has been updated to execute the filter method only when the filter parameter does not match or when changes have been made to the term object within the get_term hook. This optimization ensures that the filter is applied selectively, mitigating performance concerns and avoiding unnecessary sanitization calls.

Props spacedmonkey, flixos90, costdev, mukesh27, joemcgill, oglekler, peterwilsoncc.
Fixes #58329.
Built from https://develop.svn.wordpress.org/trunk@56650


git-svn-id: http://core.svn.wordpress.org/trunk@56162 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 16:36:20 +00:00
Bernhard Reiter
6bf6244dc7 Blocks: Implement automatic block insertion into Block Hooks.
Block Hooks allow a third-party block to specify a position relative to a given block into which it will then be automatically inserted (e.g. a "Like" button block can ask to be inserted after the Post Content block, or an eCommerce shopping cart block can ask to be inserted after the Navigation block).

The underlying idea is to provide an extensibility mechanism for Block Themes, in analogy to WordPress' [https://developer.wordpress.org/plugins/hooks/ Hooks] concept that has allowed extending Classic Themes through filters and actions.

The two core tenets for Block Hooks are:

1. Insertion into the frontend should happen right after a plugin containing a hooked block is activated (i.e. the user isn't required to insert the block manually in the editor first); similarly, disabling the plugin should remove the hooked block from the frontend.
2. The user has the ultimate power to customize that automatic insertion: The hooked block is also visible in the editor, and the user's decision to persist, dismiss (i.e. remove), customize, or move it will be respected (and reflected on the frontend).

To account for both tenets, the **tradeoff** was made to limit automatic block insertion to unmodified templates (and template parts, respectively). The reason for this is that the simplest way of storing the information whether a block has been persisted to (or dismissed from) a given template (or part) is right in the template markup.

To accommodate for that tradeoff, [https://github.com/WordPress/gutenberg/pull/52969 UI controls (toggles)] are being added to increase visibility of hooked blocks, and to allow for their later insertion into templates (or parts) that already have been modified by the user.

For hooked blocks to appear both in the frontend and in the editor (see tenet number 2), they need to be inserted into both the frontend markup and the REST API (templates and patterns endpoints) equally. As a consequence, this means that automatic insertion couldn't (only) be implemented at block ''render'' stage, as for the editor, the ''serialized'' (but ''unrendered'') markup needs to be modified.

Furthermore, hooked blocks also have to be inserted into block patterns. Since practically no filters exist for the patterns registry, this has to be done in the registry's `get_registered` and `get_all_registered` methods.

Props gziolo.
Fixes #59313.
Built from https://develop.svn.wordpress.org/trunk@56649


git-svn-id: http://core.svn.wordpress.org/trunk@56161 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 16:18:17 +00:00
Felix Arntz
b2a2411fcd Options, Meta APIs: Add further test coverage for comparison between old and new option value.
This ensures potential future changes to the logic are covered by existing tests that should pass before and after.

Props joemcgill.
See #22192.

Built from https://develop.svn.wordpress.org/trunk@56648


git-svn-id: http://core.svn.wordpress.org/trunk@56160 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 15:23:16 +00:00
desrosj
3c8457e747 Build/Test Tools: Update build related dependencies to their latest versions.
This updates the following npm dependencies:
- `autoprefixer` to version `10.4.16`.
- `grunt-contrib-qunit` to version `8.0.1`.
- `postcss` to version `8.4.30`.
- `react-refresh` to version `0.14.0`.
- `sass` to version `1.68.0`.
- `sinon` to version `16.0.0`.
- `uuid` to version `9.0.1`.
- `tslib` to version `2.6.2`.

This change accompanies a similar one in the Gutenberg repository: https://github.com/WordPress/gutenberg/pull/54657.

Props gziolo, desrosj.
Fixes #58863.
Built from https://develop.svn.wordpress.org/trunk@56647


git-svn-id: http://core.svn.wordpress.org/trunk@56159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 13:26:32 +00:00
desrosj
1df2b50c43 External Libraries: Update the polyfill-library package.
This updates the `wp-polyfill-node-contains` and `'wp-polyfill-dom-rect` scripts to the latest version, `4.8.0`.

These scripts are no longer used by WordPress Core, but are kept up to date as a courtesy.

Props rajinsharwar, hrshahin, oglekler.
Fixes #59077.
Built from https://develop.svn.wordpress.org/trunk@56646


git-svn-id: http://core.svn.wordpress.org/trunk@56158 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 12:28:33 +00:00
Sergey Biryukov
ae8ddcf935 REST API: Remove unused variable in WP_REST_Server::match_request_to_handler().
Previously initialized in `WP_REST_Server::dispatch()`, the `$response` variable became unused when the logic was split into two new methods, `::match_request_to_handler()` and `::respond_to_request()`.

Follow-up to [34928], [48947].

Props upadalavipul, mukesh27.
Fixes #59420.
Built from https://develop.svn.wordpress.org/trunk@56645


git-svn-id: http://core.svn.wordpress.org/trunk@56157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 12:19:17 +00:00
Bernhard Reiter
f6307ff5fc Blocks: Change traverse_and_serialize_block(s)'s callback signature.
During work on #59399, it was discovered that ''sibling'' block insertion wasn't likely going to work the way it was planned, which required devising an alternative solution. This new solution requires some changes to `traverse_and_serialize_block(s)`:

- Change the signature of the existing callback such that:
  - the return value is a string that will be prepended to the result of the inner block traversal and serialization;
  - the function arguments are: a ''reference'' to the current block (so it can be modified inline, which is important e.g. for `theme` attribute insertion), the parent block, and the previous block (instead of the block index and chunk index).
- Add a second callback argument to `traverse_and_serialize_block(s)`, which is called ''after'' the block is traversed and serialized.
  - Its function arguments are a reference to the current block, the parent block, and the next block.

Props gziolo.
Fixes #59412. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56644


git-svn-id: http://core.svn.wordpress.org/trunk@56156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 08:34:18 +00:00
isabel_brison
2f5d2da8f8 Editor: add lightbox setting.
Adds lightbox as a valid setting to `WP_Theme_JSON` class and as an image block setting in theme.json.

Props czapla, costdev, desrosj.
Fixes #59393.

Built from https://develop.svn.wordpress.org/trunk@56643


git-svn-id: http://core.svn.wordpress.org/trunk@56155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 06:35:20 +00:00
isabel_brison
9ba50bb623 Taxonomy: add taxonomy for user pattern categories.
Adds a `wp_pattern_category` taxonomy linked to the `wp-block` object.

Props glendaviesnz, kebbet, desrosj, mamaduka.
Fixes #59379.

Built from https://develop.svn.wordpress.org/trunk@56642


git-svn-id: http://core.svn.wordpress.org/trunk@56154 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 04:25:22 +00:00
Felix Arntz
091e385f8d Themes: Fix fatal error in load-styles.php.
Following [56635], a fatal error occurred in `load-styles.php` leading to admin styles not working, because of a `has_filter()` call being added to `get_stylesheet_director()` and `get_template_directory()`.

This changeset adds `has_filter()` to `wp-admin/includes/noop.php` to prevent such errors. The lack of loading the function does not cause any unintended side effects itself.

Props iandunn, adamsilverstein.
Fixes #59417.
See #18298.

Built from https://develop.svn.wordpress.org/trunk@56641


git-svn-id: http://core.svn.wordpress.org/trunk@56153 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 01:27:26 +00:00
isabel_brison
3c22144a0d Editor: fix typo in css_var doc update.
Fixes a type in the doc update in [56630].

Props ramonopoly, audrasjb, costdev.
Fixes #59401.

Built from https://develop.svn.wordpress.org/trunk@56640


git-svn-id: http://core.svn.wordpress.org/trunk@56152 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-21 00:18:23 +00:00
joedolson
48dfebac74 Administration: Improve control proximity in theme details modal.
Make the theme details modals in the Customizer and at Appearance > Themes consistent. Change the order of controls so both modals are in the same sequence, center all controls in both desktop and mobile views, and change delete link color to meet color contrast requirements.

Props trishasalas, afercia, melchoyce, karmatosed, cathibosco1, michaelarestad, joedolson, petitphp, mikinc860.
Fixes #59372. See #59371, #40822.
Built from https://develop.svn.wordpress.org/trunk@56639


git-svn-id: http://core.svn.wordpress.org/trunk@56151 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 21:03:20 +00:00
Weston Ruter
09d8bc184b General: Account for Sec-CH-UA-Mobile client hint request header in wp_is_mobile().
Add missing test coverage for `wp_is_mobile()`.

Fixes #59370.
Props westonruter, flixos90.

Built from https://develop.svn.wordpress.org/trunk@56638


git-svn-id: http://core.svn.wordpress.org/trunk@56150 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 20:51:19 +00:00
joedolson
ebfa9be225 XML-RPC: Add alt attribute value to media item API.
Add alt text to the `wp.getMediaItem` method in the XML-RPC API. Allows users to fetch alt text as a first-class member of a media object.

Props thomashorta, joedolson, jivygraphics, stephenerdelyi, mukesh27, whyisjake.
Fixes #58582.
Built from https://develop.svn.wordpress.org/trunk@56637


git-svn-id: http://core.svn.wordpress.org/trunk@56149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 19:31:20 +00:00
joedolson
453fb650d6 Users: Improve vertical spacing consistency in labels.
Adjust display of user profile labels on small screens so they are consistent with the layout used elsewhere.

Props nandhuraj, costdev, sabernhardt, sarathar, vivekawsm.
Fixes #58493.
Built from https://develop.svn.wordpress.org/trunk@56636


git-svn-id: http://core.svn.wordpress.org/trunk@56148 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 17:55:17 +00:00
Felix Arntz
59e8596941 Themes: Deprecate usage of TEMPLATEPATH and STYLESHEETPATH constants.
While generally the functions `get_template_directory()` and `get_stylesheet_directory()` were long recommended to use to get the parent or child theme directory, the `TEMPLATEPATH` and `STYLESHEETPATH` constants were still used in a few places in core, most importantly in template related logic.

The remaining usage was problematic as it prevented testability of certain key components of WordPress core.

This changeset replaces all remaining usage with the corresponding functions and effectively marks these constants as deprecated. It also adds test coverage accordingly and even unlocks some existing, previously commented out test coverage to work as expected.

Performance of the new approach has been benchmarked and shows no notable differences. Yet, given that the current theme directories are not expected to change within a regular WordPress page load, the `get_template_directory()` and `get_stylesheet_directory()` functions were amended with in-memory caching of the result, unless one of the defining values is being filtered.

Props thekt12, spacedmonkey, mukesh27, aaroncampbell, scribu, lloydbudd, cais, chipbennett, toscho, omarabid, CrazyJaco, DrewAPicture, obenland, wonderboymusic, nacin, helen, dd32, chriscct7, SergeyBiryukov, swissspidy, joemcgill, flixos90.
Fixes #18298.

Built from https://develop.svn.wordpress.org/trunk@56635


git-svn-id: http://core.svn.wordpress.org/trunk@56147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 17:27:23 +00:00
Bernhard Reiter
68be796e1d Blocks: Revert implementation of block insertion functions.
In [56618], three functions (`insert_inner_block`, `prepend_inner_block`, and `append_inner_block`) were introduced. They were meant to be used for insertion of hooked blocks; however, it was discovered that the original idea wouldn't work for sibling insertion. Instead, a different approach will be taken (see #59412), and these functions are no longer needed and can thus be removed.

Reverts [56618].
See #59412, #59385, #59313.
Built from https://develop.svn.wordpress.org/trunk@56634


git-svn-id: http://core.svn.wordpress.org/trunk@56146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 16:49:18 +00:00
Sergey Biryukov
b57af57210 Coding Standards: Escape the whole attribute in wp-admin/export.php.
It is best to always escape the complete value of an attribute, not a partial value, as otherwise the escaping could be (partially) undone when the values are joined together.

While the hardcoded hyphen in this case don't necessarily create that risk, it may change to a value which could be problematic, so making it a habit to escape the value in one go is best practice.

Escaping the complete value also means that a single `esc_attr()` call can be used instead of two.

Follow-up to [14444], [16652], [55616], [56632].

See #58831.
Built from https://develop.svn.wordpress.org/trunk@56633


git-svn-id: http://core.svn.wordpress.org/trunk@56145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 09:47:18 +00:00
audrasjb
5cce7674ca Coding Standards: Add missing escaping functions in wp-admin/export.php
Props viralsampat.
See #58831.




Built from https://develop.svn.wordpress.org/trunk@56632


git-svn-id: http://core.svn.wordpress.org/trunk@56144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 08:44:20 +00:00
audrasjb
25b109a0e5 Taxonomy: Restrict term edit link generation in WP_Terms_List_Table::handle_row_actions().
This changeset restricts edit term link generation if the user lacks the `edit_term` cap in order to prevent PHP 8.1+ deprecations shown when a user lacks this 
capability and `get_edit_term_link()` returns null.

Props thelovekesh, jrf.
Fixes #59336.




Built from https://develop.svn.wordpress.org/trunk@56631


git-svn-id: http://core.svn.wordpress.org/trunk@56143 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 08:10:16 +00:00
isabel_brison
d761ed56ca Editor: update docs for css_var.
Updates inline doc for the `css_var` key value pair in WP_Style_Engine.

Props ramonopoly.
Fixes #59401.

Built from https://develop.svn.wordpress.org/trunk@56630


git-svn-id: http://core.svn.wordpress.org/trunk@56142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 07:06:20 +00:00
isabel_brison
9699ef2e41 Editor: Fix post editor layout when Post Content has no attributes.
Changes output of `wp_get_post_content_block_attributes` to return null if Post Content block doesn’t exist or empty array if it has no attributes.

Props flixos90, mukesh27.
Fixes #59358.

Built from https://develop.svn.wordpress.org/trunk@56629


git-svn-id: http://core.svn.wordpress.org/trunk@56141 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-20 01:26:19 +00:00
costdev
f388dc8e38 Login and Registration: Introduce classes wp-login.php footer links.
This introduces classes for the "Log in", "Register" and "Lost your password?" links in the footer of `wp-login.php` forms so that they may be easily targeted for individual styling.

The new classes are:
- `.wp-login-log-in`
- `.wp-login-register`
- `.wp-login-lost-password`

Props wparslan, thomasplevy, rajinsharwar, audrasjb, joedolson, costdev.
Fixes #57590.
Built from https://develop.svn.wordpress.org/trunk@56628


git-svn-id: http://core.svn.wordpress.org/trunk@56140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 22:45:19 +00:00
desrosj
081e87f702 External Libraries: Update the regenerator-runtime version.
Adds the required change to the `script-loader.php` file for [56626] that was missed.

See #59078.
Built from https://develop.svn.wordpress.org/trunk@56627


git-svn-id: http://core.svn.wordpress.org/trunk@56139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 19:32:12 +00:00
desrosj
da0c2396bb External Libraries: Update the regenerator-runtime library.
This updates the `regenerator-runtime` library to version `0.14.0`.

Props rajinsharwar, oglekler.
Fixes #59078.
Built from https://develop.svn.wordpress.org/trunk@56626


git-svn-id: http://core.svn.wordpress.org/trunk@56138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 19:30:24 +00:00
Joe McGill
0475a61f8a Media: Edit new hook name in get_available_post_mime_types().
This is a follow-up to [56452] in which a new filter hook was added to `get_available_post_mime_types()` to override a potentially slow query. This renames the previous hook from `get_available_post_mime_types` to `pre_get_available_post_mime_types` for clarity.

Props rcorrales, emrikol, johnbillion, joemcgill, mukesh27.
Fixes #52759.

Built from https://develop.svn.wordpress.org/trunk@56623


git-svn-id: http://core.svn.wordpress.org/trunk@56135 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 17:05:21 +00:00
costdev
e1e541a1b3 Build/Test Tools: Add sys_get_temp_dir() to open_basedir tests.
In PHPUnit 10.3.5, 9.6.13 and 8.5.34, the child processes used for process isolation now use temporary files to communicate their result to the parent process.

This caused a failure in some tests that set the `open_basedir` PHP directive to a value that did not include `sys_get_temp_dir()`.

This adds `sys_get_temp_dir()` to the `open_basedir` value set by the tests to ensure that permission is still granted for the temporary directory.

PHPUnit uses `sys_get_temp_dir()`. To ensure the result is the same, Core's `get_temp_dir()` function is not used.

References:
- https://github.com/sebastianbergmann/phpunit/issues/5356

Props desrosj, mukesh27, SergeyBiryukov, costdev.
Fixes #59394.
Built from https://develop.svn.wordpress.org/trunk@56622


git-svn-id: http://core.svn.wordpress.org/trunk@56134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 16:43:19 +00:00
spacedmonkey
8fdddd7b6d Themes: Improve performance of get_block_theme_folders function
This commit enhances the performance of the get_block_theme_folders function by introducing a new method called get_block_template_folders within the WP_Theme class. Previously, this function suffered from poor performance due to repeated file lookups using file_exists. The new method implements basic caching, storing the result in the theme's cache, similar to how block themes are cached in the block_theme property (see [55236]).

Additionally, this change improves error handling by checking if a theme exists before attempting to look up the file. It also enhances test coverage. 

Props spacedmonkey, thekt12, swissspidy, flixos90, costdev, mukesh27.
Fixes #58319.
Built from https://develop.svn.wordpress.org/trunk@56621


git-svn-id: http://core.svn.wordpress.org/trunk@56133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 16:17:22 +00:00
gziolo
d3a8869891 Blocks: Introduce a variation of serialize blocks helper with traversing
Introduces two new functions `traverse_and_serialize_blocks` and `traverse_and_serialize_block` with the additional `$callback` argument. It is possible to pass parent block, block index, chunk index to the callback argument.

Reverts changes applied to `serialize_blocks` and `serialize_block` in #59327 with [56557].

Props ockham, mukesh27.
See #59313.



Built from https://develop.svn.wordpress.org/trunk@56620


git-svn-id: http://core.svn.wordpress.org/trunk@56132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 12:50:19 +00:00
costdev
8fbd793f33 Editor: Fix parameter reference in block editor settings tests.
In [50776], the `filter_set_block_editor_settings_post()` callback was introduced for use in block editor settings tests.

This contained a reference to an `$allowed_block_types` parameter, which doesn't exist.

This changes the reference to `$editor_settings`.

Follow-up to [50776].

Props david.binda, mukesh27, SergeyBiryukov.
Fixes #59391.
Built from https://develop.svn.wordpress.org/trunk@56619


git-svn-id: http://core.svn.wordpress.org/trunk@56131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 12:38:23 +00:00
Bernhard Reiter
43b728aec5 Blocks: Implement block insertion functions.
For #59313, we need to implement functions to insert a given parsed block into another parsed block's inner blocks, and to prepend and append to that array, respectively.

We will use those functions in combination with `traverse_and_serialize_blocks` (see #59327) to implement automatic insertion of hooked blocks into block templates and patterns.

Props gziolo.
Fixes #59385.
Built from https://develop.svn.wordpress.org/trunk@56618


git-svn-id: http://core.svn.wordpress.org/trunk@56130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 12:36:20 +00:00
Sergey Biryukov
8b18bab4e6 KSES: Add writing-mode to the list of safe CSS properties.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/54581 #54581 Gutenberg Plugin: Add hook to allow `writing-mode` as a safe CSS property]

Reference: [https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode MDN Web Docs: writing-mode].

Follow-up to [56605].

Props wildworks, mukesh27, poena, andrewserong.
Fixes #59387.
Built from https://develop.svn.wordpress.org/trunk@56617


git-svn-id: http://core.svn.wordpress.org/trunk@56129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 12:30:14 +00:00
costdev
1ef9332fb0 Coding Standards: Replace PHP alias join() with implode().
In [52190], some new instances of the `join()` alias were introduced in the test suite.

Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces the new `join()` uses with the canonical `implode()` function name.

Follow-up to [46182], [49193], [49805], [52190].

Props david.binda, mukesh27.
Fixes #59389.
Built from https://develop.svn.wordpress.org/trunk@56616


git-svn-id: http://core.svn.wordpress.org/trunk@56128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 12:25:21 +00:00
isabel_brison
9c827704be Editor: fix pattern alignment in editor view.
Adjusts root padding for synced patterns in the editor to avoid discrepancies with the front end view.

Props aaronrobertshaw, mukesh27.
Fixes  #59359.

Built from https://develop.svn.wordpress.org/trunk@56615


git-svn-id: http://core.svn.wordpress.org/trunk@56127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 01:45:21 +00:00
isabel_brison
82f6ce639b Editor: add background image support.
Adds a new background block support with the ability to set a background image on blocks that opt into it.

Props andrewserong, mukesh27.
Fixes #59357.

Built from https://develop.svn.wordpress.org/trunk@56614


git-svn-id: http://core.svn.wordpress.org/trunk@56126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-19 01:29:23 +00:00
Felix Arntz
90a29fbc46 Bundled Theme: Add missing dimension attributes to images in Twenty Twenty-Two patterns.
The dimension attributes `width` and `height` should be present on every image in order to avoid layout shifts and be able to leverage WordPress core's image loading optimization functionality.

This changeset adds dimension attributes to the `core/image` blocks used in block patterns in Twenty Twenty-Two, where this is particularly critical as WordPress core cannot backfill the attributes for those images, as their sources are not part of the Media Library.

Props spacedmonkey, thekt12, mukesh27, flixos90.
Fixes #59256.

Built from https://develop.svn.wordpress.org/trunk@56613


git-svn-id: http://core.svn.wordpress.org/trunk@56125 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 17:38:19 +00:00
Felix Arntz
56b5244fdb Media: Enhance wp_get_loading_optimization_attributes() to support arbitrary context values.
The `wp_get_loading_optimization_attributes()` function, which was introduced in 6.3, based on the now deprecated `wp_get_loading_attr_default()` function introduced in 5.5, relies on a `$context` parameter based on which it may alter its behavior and the attributes returned. So far, it has only supported context values used within WordPress core.

This changeset decouples the behaviors of the function from specific contexts, allowing for more flexibility. Theme and plugin developers will be able to rely on their own context values when rendering images in non-standard ways, rather than being forced to use a core context, to get the loading optimization benefits the function provides.

As part of this change, a `wp_loading_optimization_force_header_contexts` filter is introduced, which allows filtering the map of context values and whether they should be considered header contexts, i.e. i.e. any image having one of these contexts will be assumed to appear above the fold.

Props mukesh27, costdev, flixos90.
Fixes #58894.

Built from https://develop.svn.wordpress.org/trunk@56612


git-svn-id: http://core.svn.wordpress.org/trunk@56124 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 14:55:18 +00:00
Sergey Biryukov
1b5fc476f8 Quick Edit: Allow Quick Edit to be disabled for custom post types or taxonomies.
Some custom post types or taxonomies may not need the Quick Edit functionality, in which case adding hidden fields and rendering the form with the data to edit would be redundant.

This commit introduces two filters for more granular control:

* `quick_edit_enabled_for_post_type`
* `quick_edit_enabled_for_taxonomy`

Follow-up to [8857], [9083], [9098].

Props garyc40, sabernhardt, mukesh27, costdev, oglekler, wyrfel, peterwilsoncc, faguni22, robinwpdeveloper, webcommsat, johnbillion, azaozz, hellofromTonya, GunGeekATX, Jick, mikeschinkel, jane, nacin, helen, wonderboymusic, DrewAPicture, SergeyBiryukov.
Fixes #16502, #19343, #57596.
Built from https://develop.svn.wordpress.org/trunk@56611


git-svn-id: http://core.svn.wordpress.org/trunk@56123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 13:19:19 +00:00
gziolo
7520c3fb46 Blocks: Introduce helper function to retrieve hooked blocks
In order to implement Block Hooks (see #59313), we added block_hooks field to the WP_Block_Type class, as well as to block registration related functions. In this follow-up, new helper function gets introduced that is going to compute the list of hooked blocks by other registered blocks for a given block type.

Extracted from https://github.com/WordPress/wordpress-develop/pull/5158 and covered with unit tests.

Props ockham.
Fixes #59383.


Built from https://develop.svn.wordpress.org/trunk@56610


git-svn-id: http://core.svn.wordpress.org/trunk@56122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 12:43:13 +00:00
spacedmonkey
323d8cb19d Plugins: Store result of call to array_keys, to save repeated calls in WP_Hook class.
In the `WP_Hook` class the function `array_keys` was called every time an array of hook priorities was needed. For sites with lots of filters or actions, this would result in thousands of calls to the `array_keys` function, which uses server resources. Instead of recomputing this array every time it is needed, only compute it when filters are added and removed, then store the result as a class property. Improve unit tests to ensure this behaviour is tested. 

Props spacedmonkey, bor0, flixos90, hellofromTonya, mukesh27.
Fixes #58458.
Built from https://develop.svn.wordpress.org/trunk@56609


git-svn-id: http://core.svn.wordpress.org/trunk@56121 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 12:41:18 +00:00
costdev
cc1bb87546 Docs: Document aria-live and hidden in safecss_filter_attr().
In [56603], support was added for `aria-live` and `hidden` attributes in `safecss_filter_attr()`.

This adds a `@since` annotation to document this change.

Follow-up to [56603].

Props mukesh27.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56608


git-svn-id: http://core.svn.wordpress.org/trunk@56120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 10:57:16 +00:00
gziolo
918a9a69b1 Tests: Add additional tests covering Block Hooks registration
Props ockham.
See #59346.
Follow-up [56587].


Built from https://develop.svn.wordpress.org/trunk@56607


git-svn-id: http://core.svn.wordpress.org/trunk@56119 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 10:35:23 +00:00
isabel_brison
51c1ee1b9c Posts: update admin notices to refer to patterns.
Updates `wp_block` action notices to refer to patterns instead of blocks.

Props aaronrobertshaw, mukesh27, oglekler.
Fixes #59305.

Built from https://develop.svn.wordpress.org/trunk@56606


git-svn-id: http://core.svn.wordpress.org/trunk@56118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 07:04:19 +00:00
isabel_brison
df3137aca1 Editor: add text orientation for blocks with typography support.
Adds a new text orientation option to the typography block support, implemented with CSS writing-mode.

Props poena.
Fixes #59306.

Built from https://develop.svn.wordpress.org/trunk@56605


git-svn-id: http://core.svn.wordpress.org/trunk@56117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 06:49:20 +00:00
isabel_brison
305ccb98e0 Editor: add block instance element color support for buttons and headings.
Adds support for buttons and headings to the colors and elements block supports, allowing button and heading element colors to be changed on individual blocks.

Props aaronrobertshaw.
Fixes #59309.


Built from https://develop.svn.wordpress.org/trunk@56604


git-svn-id: http://core.svn.wordpress.org/trunk@56116 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 06:27:19 +00:00
joedolson
a73260baf4 Administration: Add support for attributes in wp_admin_notice().
Allow admin notices to be created with additional attributes. Test attributes include `hidden`, `data-*`, and `role="*"` values, which are all in use in various admin notices across core. 

This commit adds `aria-live` and `hidden` to the KSES global attributes array to support core usages.

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601], [56602].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56603


git-svn-id: http://core.svn.wordpress.org/trunk@56115 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 00:30:18 +00:00
joedolson
9922dfd54c Administration: Move tabindex="-1" from notice to JS.
In a handful of admin notices, a `tabindex` attribute is set so that JS can move focus to the notice `div`. Rather than adding `tabindex` to globally accepted attributes for `wp_kses_post()`, move the assignment of `tabindex` into the JS handlers that display those notices. The attribute is only relevant if JS is running, so there is no reason to add it in the original HTML notice.

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600], [56601].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56602


git-svn-id: http://core.svn.wordpress.org/trunk@56114 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 22:51:24 +00:00
joedolson
3f690e5763 Administration: Use wp_admin_notice() in wp-admin/network/.
Add additional usage of `wp_admin_notice()` in `wp-admin/network/` where previously overlooked. 

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599], [56600].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56601


git-svn-id: http://core.svn.wordpress.org/trunk@56113 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 19:12:21 +00:00
joedolson
3356f6e33f Administration: Use wp_admin_notice() more in wp-admin/.
Add additional usage of `wp_admin_notice()` in `wp-admin/` on `.error` and miscellaneous usages previously overlooked. 

Follow up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597], [56599].

Props costdev, joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56600


git-svn-id: http://core.svn.wordpress.org/trunk@56112 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 15:33:17 +00:00
costdev
6cdd74585d Administration: Use wp_admin_notice() more in /wp-admin/includes/.
Adds further usages of `wp_admin_notice()` in `/wp-admin/includes/` on `.notice-error`, `.notice-warning`, `.error`, and `.updated`.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590], [56597].

Props joedolson, mukesh27, costdev.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56599


git-svn-id: http://core.svn.wordpress.org/trunk@56111 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 15:23:22 +00:00
Sergey Biryukov
3546f04e16 Coding Standards: Fix a few newly introduced WPCS issues.
Follow-up to [56515], [56557], [56560].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56598


git-svn-id: http://core.svn.wordpress.org/trunk@56110 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-17 02:10:17 +00:00
costdev
0223bd9ad6 Administration: Increase wp_admin_notice() usage in /wp-includes/.
Adds further usages of `wp_admin_notice()` in the root level of `/wp-includes/` on `.error` and `.notice-info`.

Ongoing task to implement new function across core.

Follow-up to [56408], [56409], [56410], [56518], [56570], [56571], [56572], [56573], [56576], [56589], [56590].

Props joedolson, costdev.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56597


git-svn-id: http://core.svn.wordpress.org/trunk@56109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-16 21:49:27 +00:00
Sergey Biryukov
30a1eec22a Coding Standards: Remove extra parentheses in a few str_contains() conditionals.
Follow-up to [55988].

Props Cybr.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56596


git-svn-id: http://core.svn.wordpress.org/trunk@56108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-16 06:50:23 +00:00
spacedmonkey
127209a9fe Options, Meta APIs: Optimize get_option by relocating notoptions cache lookup.
In the get_option function, a cache lookup for the notoptions key is performed, which stores an array of keys for options known not to exist. This optimization prevents repeated database queries when certain options are requested. However, the cache lookup for notoptions was conducted before checking if the requested option exists in the cache. Given that it's more likely that the option does exist, this commit reorders the checks to first verify the option's existence in the cache before confirming its absence. This adjustment reduces redundant queries and also eliminates an unnecessary cache lookup, improving overall performance.

Props spacedmonkey, costdev, flixos90, azaozz.
Fixes #58277.
Built from https://develop.svn.wordpress.org/trunk@56595


git-svn-id: http://core.svn.wordpress.org/trunk@56107 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-15 16:15:22 +00:00
Sergey Biryukov
e458b35a96 Coding Standards: Remove the custom property for the FileName sniff.
Test files should comply with the naming conventions accepted by PHPUnit, not with the WP naming conventions.

While the `WordPress.File.FileName` sniff makes a best effort to prevent throwing errors for files containing test classes, the recommended manner to deal with test files is to exclude the complete test directory from being subject to this sniff.

This updates the ruleset to follow the recommendation.

Follow-up to [42346], [45607].

Props jrf.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56594


git-svn-id: http://core.svn.wordpress.org/trunk@56106 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-15 10:47:23 +00:00
Sergey Biryukov
26d10fdc72 Coding Standards: Improve organization of the WPCS-based PHPCS ruleset.
This commit:
* Adds section headers to the ruleset file.
* Organizes all directives in their respective sections.

No functional changes.

Props jrf.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56593


git-svn-id: http://core.svn.wordpress.org/trunk@56105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-15 09:08:17 +00:00
gziolo
ad261fbf4e Blocks: Remove the gutenberg textdomain accidently added to translation
Props soean.
See #59346.
Follow-up [56587].


Built from https://develop.svn.wordpress.org/trunk@56592


git-svn-id: http://core.svn.wordpress.org/trunk@56104 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-15 07:51:19 +00:00
joedolson
5f21a9dafd Media: Fix focus loss when closing Image Rotation menu.
Only shift focus into menu when opening the menu. Check `aria-expanded` value of toggle before moving focus.

Props joedolson.
Fixes #59353.
Built from https://develop.svn.wordpress.org/trunk@56591


git-svn-id: http://core.svn.wordpress.org/trunk@56103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 22:35:16 +00:00
joedolson
e012f30025 Administration: additional_classes is not a function.
Correct usage of `additional_classes` array parameter as if it were a function. Clearly, I'm getting tired and missing things. So many little changes. Follow up to [56573].

Props joedolson.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56590


git-svn-id: http://core.svn.wordpress.org/trunk@56102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 22:10:24 +00:00
joedolson
3ce9440a01 Administration: Fix undeclared variable.
Moved `$updated_notice_args` to be defined before the conditional in which it's used.

Props TobiasBg.
See #57791.
Built from https://develop.svn.wordpress.org/trunk@56589


git-svn-id: http://core.svn.wordpress.org/trunk@56101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 17:12:20 +00:00
gziolo
61594c3b64 Tests: Improve the assertions for REST API endpoint for block types
Follow-up to [56587], [55673]. While working on #59346, it was noted that selectors fiels is not always included in the assertions. While looking at it is was difficult to spot the issue because the random order of how REST API fields where listed.

Reorderd the REST API fields in the test cases to follow the list from the documentation: https://github.com/WordPress/gutenberg/blob/trunk/docs/reference-guides/block-api/block-metadata.md. This way it's going to be easier to maintain the list moving forward.

Props ockham.
See #59346, #59313, #57585.


Built from https://develop.svn.wordpress.org/trunk@56588


git-svn-id: http://core.svn.wordpress.org/trunk@56100 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 14:56:18 +00:00
Bernhard Reiter
0b79362805 General: Add block_hooks field to block type registration, REST API.
In order to implement Block Hooks, we need to add a new `block_hooks` field to the `WP_Block_Type` class, as well as to block registration related functions, the block types REST API controller, etc.

Props gziolo.
Fixes #59346. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56587


git-svn-id: http://core.svn.wordpress.org/trunk@56099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 13:25:18 +00:00
Sergey Biryukov
1aca5e48e5 Coding Standards: Restore more descriptive variable names in a few class methods.
When various methods parameters in child classes were renamed to `$item` to match the parent class for PHP 8 named parameter support, most of the methods restored the more descriptive, specific name at the beginning for better readability, with several exceptions for methods consisting only of a few lines.

To avoid confusion about why some methods do that and some don't, this commit aims to bring more consistency to the code, specifically in list tables' `::column_default()` methods.

Follow-up to [51728], [51737], [51786].

See #58831.
Built from https://develop.svn.wordpress.org/trunk@56586


git-svn-id: http://core.svn.wordpress.org/trunk@56098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 12:46:20 +00:00
spacedmonkey
6388ac820b Taxonomy: Introduce 'cache_results' parameter to WP_Term_Query for bypassing query caching.
Incorporating a new 'cache_results' parameter into the WP_Term_Query class, this commit empowers developers with the ability to bypass query caches, explicitly triggering database queries when needed.  This brings the `WP_Term_Query` class inline with `WP_Query` and `WP_User_Query` that already have a 'cache_results' parameter.

Update the `term_exists` function to use this new parameter, so the term query caches are not used while importing. 

Props dlh, spacedmonkey, peterwilsoncc.
Fixes #52710.
Built from https://develop.svn.wordpress.org/trunk@56585


git-svn-id: http://core.svn.wordpress.org/trunk@56097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 12:40:18 +00:00
gziolo
bb3fac7b77 Tests: Split tests for _inject_theme_attribute_in_template_part_block
Follow-up to [56578].
See #59338.


Built from https://develop.svn.wordpress.org/trunk@56584


git-svn-id: http://core.svn.wordpress.org/trunk@56096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 11:47:18 +00:00
spacedmonkey
f19df46584 Bundled Theme: Implement the_header_image_tag function for enhanced compatibility for older core themes.
The `the_header_image_tag` function was introduced in WordPress 4.4 as part of [35594]. It is used in all themes created post WordPress 4.4 that supported header images. The function `get_header_image_tag` continues to get updated with new image features, like lazy loading, async decoding and fetch priority. To ensure our core themes maintain compatibility and benefit from these enhancements, a backward compatibility shim has been applied, integrating the `the_header_image_tag` function into the following core themes:

- Twenty Ten
- Twenty Eleven
- Twenty Twelve
- Twenty Fourteen
- Twenty Sixteen

This change ensures future compatibility and modern image features are applied for header images to these older themes. 

Props spacedmonkey, flixos90, mukesh27.
Fixes #58675.
Built from https://develop.svn.wordpress.org/trunk@56583


git-svn-id: http://core.svn.wordpress.org/trunk@56095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 11:25:19 +00:00
Tammie Lister
18514a1d8c Twenty Ninteen: Revert changes to 'style-rtl.css'.
This revert changes to Twenty Nineteen 'style-rtl.css' file made in [56580] as it auto-generated during the build process.

Unprops karmatosed.
Props costdev.
See #58443.

Built from https://develop.svn.wordpress.org/trunk@56581


git-svn-id: http://core.svn.wordpress.org/trunk@56093 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 10:25:22 +00:00
Tammie Lister
7d3694a17c Twenty Nineteen: Fixes button line height.
Line height was broken for button block and adding spacing.

Props nidhidhandhukiya, shailu25.
Fixes #58443.

Built from https://develop.svn.wordpress.org/trunk@56580


git-svn-id: http://core.svn.wordpress.org/trunk@56092 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 09:47:19 +00:00
Bernhard Reiter
0dace57414 Themes: Fix @covers PHPDoc line for test.
Follow-up to [56578].
Props @mukesh27.
See #59338.
Built from https://develop.svn.wordpress.org/trunk@56579


git-svn-id: http://core.svn.wordpress.org/trunk@56091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 09:06:26 +00:00
Bernhard Reiter
172397e6e5 Themes: Inject theme attribute during serialization.
Rather than using `_inject_theme_attribute_in_block_template_content` to inject the `theme` attribute into all Template Part blocks found in a given file-based Block Template, introduce a new function called `_inject_theme_attribute_in_template_part_block`, and use that as second argument to `serialize_blocks()` (introduced in [56557]) in order to inject said attribute during tree traversal for serialization.

This allows for a more modular approach that will eventually be extended to implement automatic insertion of hooked blocks.

Note that we're guarding `_build_block_template_result_from_file()` (i.e. the callsite of `_inject_theme_attribute_in_template_part_block` and previously of `_inject_theme_attribute_in_block_template_content`) against regressions through additional unit test coverage added in [56562].

Props @gziolo.
Fixes #59338. See #59313.
Built from https://develop.svn.wordpress.org/trunk@56578


git-svn-id: http://core.svn.wordpress.org/trunk@56090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 08:52:19 +00:00
isabel_brison
da2581b4c1 Post Types: allow trashing draft patterns.
Adds `delete_posts` to capabilities for the `wp_block` post type.

Props ramonopoly, johnbillion, dhruvishah2203, audrasjb.
Fixes #59041.

Built from https://develop.svn.wordpress.org/trunk@56577


git-svn-id: http://core.svn.wordpress.org/trunk@56089 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-14 05:53:11 +00:00