Introduced in [56101] the `WP_Duotone` class, hooks into the `wp_loaded` action to load duotone style data from global styles. Hooking in early in the bootstrap process caused a number of problems. This hook, triggered an error on installing, as this lookup for global styles, would result in a global post trying to be created, even before the table existed. Additionally, this implementation caused a severe performance regression, as duotone styling data was loaded unnecessarily for requests that did not require such data, such as REST API calls or actions within the wp-admin interface.
In this change, refactor the `WP_Duotone` to lazily load the global styles and theme.json data, only when a block that supports duotone is encountered. The method `render_duotone_support` was change to take a third parameter to reuse the existing `WP_Block_Type` object passed to the filter, to save it being looked up again. The code has also got improved type checking and the use of the util function `block_has_support`. Furthermore, the code's readability has been improved, along with enhancements to the documentation blocks.
Props Chouby, spacedmonkey, SergeyBiryukov, swissspidy, costdev, joemcgill, flixos90, mukesh27, nazmul111, ajlende, isabel_brison.
Fixes#58673.
Built from https://develop.svn.wordpress.org/trunk@56226
git-svn-id: http://core.svn.wordpress.org/trunk@55738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Since switching to the Blink engine, Opera browsers contain both the strings `Chrome` and `OPR\`. This change relocates the Opera test to take place before the Chrome test to ensure the correct browser is detected.
Props brasofilo, desrosj, costdev, mukesh27, swissspidy.
Fixes#46132.
Built from https://develop.svn.wordpress.org/trunk@56224
git-svn-id: http://core.svn.wordpress.org/trunk@55736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduce the development mode `all` as a a cover-all mode for the existing `theme`, `plugin` and `core` development modes. Developers can use the `all` mode if they are developing both themes and plugins, for example.
Introduce the utility function `wp_in_development_mode()` allowing developers to detect the mode via a parameter. If the development mode is set to `all` this function will always return `true`. If the development mode is specific then only the chosen mode will return `true`.
Follow up to [56079,56042].
Props flixos90.
Fixes#57487.
Built from https://develop.svn.wordpress.org/trunk@56223
git-svn-id: http://core.svn.wordpress.org/trunk@55735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This aims to make all the various ways of contributing to open-source WordPress project more discoverable, as well as make it easier to find an area that aligns with new contributor’s skills and interests.
Props oglekler, jpantani, SeReedMedia, ryelle, marybaum, karmatosed, eidolonnight, mt_suzette, Shelob9, desrosj, cathibosco1, jenmylo, nacin, helen, joostdevalk, hugobaeta, TacoVerdo, swissspidy, markoheijnen, lukecavanagh, boemedia, bridgetwillard, jeffmora, davidmusnik, mehdi01, johnbillion, fierevere, tobifjellner, richtabor, meher, courane01, webcommsat, audrasjb, mukesh27, davidbaumwald, costdev, joedolson, robinwpdeveloper, estelaris, mohiuddinomran, SergeyBiryukov.
See #23348.
Built from https://develop.svn.wordpress.org/trunk@56220
git-svn-id: http://core.svn.wordpress.org/trunk@55732 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Add `wp_json_encode()` as an escaping function when setting the `WP_BLOCK_THEME_ACTIVATE_NONCE` global on the block theme preview screen.
This account for custom nonce implementations making use of special characters that require escaping in JavaScript strings.
Props antonvlasenko, ramonopoly.
Fixes#58712.
Built from https://develop.svn.wordpress.org/trunk@56218
git-svn-id: http://core.svn.wordpress.org/trunk@55730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This fixes an issue where images dynamically created during shortcode rendering (e.g., shortcode image galleries), were not getting image optimizations like `loading="lazy"` or `fetchpriority="hight"` applied. Note that even after this commit, shortcodes are processed after the main content images, which can affect the order in which optimizations are applied in content areas.
Follow-up to [56037].
Props spacedmonkey, flixos90, thekt12, swissspidy, joemcgill.
Fixes#58681.
Built from https://develop.svn.wordpress.org/trunk@56214
git-svn-id: http://core.svn.wordpress.org/trunk@55726 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This resets the main query variable, `$wp_the_query` during the `WP_UnitTestCase_Base::tear_down` method that runs after each PHPUnit test. This ensures any changes to the main query object is reset after each test to avoid cross contamination between tests, similar to how other globals are reset.
Props flixos90, spacedmonkey, joemcgill.
Fixes#58776.
Built from https://develop.svn.wordpress.org/trunk@56212
git-svn-id: http://core.svn.wordpress.org/trunk@55724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset modifies how the `dashicons-external` icon is used in external links by editing its styles and adding a space between the text and the icon
for better accessibility.
Props SergeyBiryukov, afercia, isabel_brison, mukesh27, sabernhardt, oglekler, audrasjb.
Fixes#47303.
Built from https://develop.svn.wordpress.org/trunk@56211
git-svn-id: http://core.svn.wordpress.org/trunk@55723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a global, `$_wp_current_template_id`, to allow the 'Edit site' link in the admin bar to be aware of the current template and pass it to the Site Editor, so it can load the appropriate one directly.
See https://github.com/WordPress/gutenberg/issues/37850 for further discussion.
Props Mamaduka, poena, abitofmind, audrasjb, mikinc860, alexstine, annezazu, beckej, jameskoster, bacoords, clubkert, paaljoachim, get_dave, priethor, skorasaurus.
Fixes#58746.
Built from https://develop.svn.wordpress.org/trunk@56209
git-svn-id: http://core.svn.wordpress.org/trunk@55721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Update the Pattern post type `edit_item` label to be `Edit Block Pattern` instead of `Edit Pattern` so Chrome doesn’t open the translation modal.
Props andrewserong,, ramonopoly, eric.7186, audrasjb, wildworks, Toro_Unit.
Fixes#58716.
Built from https://develop.svn.wordpress.org/trunk@56200
git-svn-id: http://core.svn.wordpress.org/trunk@55712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds a nonce so that activation works for block theme previews. Temporary fix until there is a REST API endpoint for activating themes.
Props scruffian, peterwilsoncc, nithins53, nithi22, jomonthomaslobo1, poena, syamraj24, vivekawsm, mrinal013.
Fixes#58712.
Built from https://develop.svn.wordpress.org/trunk@56199
git-svn-id: http://core.svn.wordpress.org/trunk@55711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Improve logic in `wp_theme_has_theme_json()` to improve caching soo it takes into account that a theme can be switched. Before this function would overly cache if the current theme has a theme.json file. Now it use the value of `get_stylesheet()` as a key to an array. This way, if the value of stylesheet is changed, by either a filter or in a unit test, a new check to see if the file exists is run. For this reason, the workaround to check if unit tests are running by checking if `WP_RUN_CORE_TESTS` constant exists can be removed.
Props westonruter, spacedmonkey, flixos90.
Fixes#58758.
Built from https://develop.svn.wordpress.org/trunk@56185
git-svn-id: http://core.svn.wordpress.org/trunk@55697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset fixes both `register_block_script_handle()` and `register_block_style_handle()` functions, allowing for child themes to access and utilise
blocks defined in parent themes.
Previously these functions could not handle blocks registered in Parent themes. This changeset fixes the issue by determining whether the given asset path
belongs to either of the template or stylesheet directories (Parent and Child themes respectively) as opposed to just checking using
`get_theme_file_path('')`.
Props jacknotman, Levdbas, audrasjb, guillaumeturpin, leprincenoir, whaze, isabel_brison.
Fixes#57566.
--Cette ligne, et les suivantes ci-dessous, seront ignorées--
M trunk/src/wp-includes/blocks.php
Built from https://develop.svn.wordpress.org/trunk@56183
git-svn-id: http://core.svn.wordpress.org/trunk@55695 1a063a9b-81f0-0310-95a4-ce76da25c4cd