Commit Graph

36862 Commits

Author SHA1 Message Date
noisysocks
1f57be1a1e Block Themes: Add support for relative URLs in top-level theme.json styles
Allow using relative `file:` URLs in top-level theme.json properties such as
`styles.background`, and modify the REST API to provide clients with the
absolute URLs via a 'https://api.w.org/theme-file' attribute in the `_links`
array.

Props ramonopoly.
Fixes #61273.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-31 01:19:14 +00:00
Sergey Biryukov
de4d4199cb Coding Standards: Use strict comparison in wp-includes/user.php.
Follow-up to [2895], [3481], [5627], [https://mu.trac.wordpress.org/changeset/1581 mu:1581], [https://mu.trac.wordpress.org/changeset/1612 mu:1612], [12603], [18504], [33771], [41653], [41654], [45708], [51399].

Props dhruvang21, aristath, poena, afercia, SergeyBiryukov.
Fixes #61315. See #60700.
Built from https://develop.svn.wordpress.org/trunk@58261


git-svn-id: http://core.svn.wordpress.org/trunk@57724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 21:19:18 +00:00
hellofromTonya
4b331a84ef Plugins: Revert r58081 show an admin notice on successful activation.
With a new direction in the 6.5.4 to restore the Activate button's href (see [58250]), the changesets committed for 6.5.3 (see #60992) are now dead code and will not render the admin notice on successful plugin activation.

This commit is a clean revert of r58081.

Follow-up to [58250].

Props swissspidy, azaozz, costdev, jorbin, hellofromTonya, afragen.
Fixes #61331.
See #60992, #61319.
Built from https://develop.svn.wordpress.org/trunk@58257


git-svn-id: http://core.svn.wordpress.org/trunk@57720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 17:09:10 +00:00
joedolson
8f7d5cf1ca Menus: Add resize: vertical to menu item selector panel.
Make the panels for selecting menu items to add to a panel resizable using the CSS `resize` property. This minor change makes it easier to select items to add on desktop devices, and has nominal impact on other interfaces.

Props namith.jawahar, NekoJonez, jorbin, joen, joedolson.
Fixes #60763.
Built from https://develop.svn.wordpress.org/trunk@58256


git-svn-id: http://core.svn.wordpress.org/trunk@57719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 16:43:17 +00:00
hellofromTonya
568d9ad5a2 Plugin Dependencies: Ensure dependency detection for newly installed plugins.
Resolves a bug by first initializing in the AJAX callback `WP_Plugin_Dependencies::check_plugin_dependencies_during_ajax()`.

More details:

[57658] removed auto-deactivation and bootstrapping logic from the Plugin Dependencies feature. In doing so, initialization calls were added to various locations in Core to ensure dependencies were detected and ready to be checked. However, an initialization call was missed in the AJAX callback before checking plugin dependencies.

This means that a plugin's dependencies may not be detected, and lead to a false positive, which in turn allows the user to click Activate only to see a failure message.

Follow-up to [57658].

Props kevinwhoffman, costdev, afragen.
Fixes #61294.
Built from https://develop.svn.wordpress.org/trunk@58252


git-svn-id: http://core.svn.wordpress.org/trunk@57715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 15:15:10 +00:00
desrosj
4ddc6531d5 Build/Test Tools: Add supported MySQL versions for 6.6 to the support file.
See #60705.
Built from https://develop.svn.wordpress.org/trunk@58251


git-svn-id: http://core.svn.wordpress.org/trunk@57714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 14:55:14 +00:00
hellofromTonya
466f6207e6 Upgrade/Install: Restore Activate button's href native behavior.
Restores the Activate button's `href` native behavior by changing the AJAX activation handler introduced in 6.5.0. It restores the pre-6.5 behavior of clicking the "Activate" button, i.e. navigates the user to the button's `href` (i.e. to the `plugins.php` UI).

Why?

Feedback was given after shipping [57545] in 6.5.0 (but was unknown during the development and testing cycles) revealed significant impacts for plugins who's users valued the onboarding / configuration experiences.

6.5.3's [58081] and [58083] added a new user action / step to the workflow. Though helpful, it did not fully resolve the impacts.

For the minor, this commit seeks to restore only the "Activate" button's `href` pre-6.5 native behavior to resolve the regression.

The next phase of the Add Plugins workflow can then continue in a major release to gain the benefits of a full major to move it from ideation through the development phases. (See #61040). The questions of redirect, how / should configuration be in the workflow, etc. can best be explored and experimented with in a major.

Follow-up to [57545], [58081], [58083].

Props costdev, jorbin, hellofromTonya, afragen, kevinwhoffman, azaozz, adrianduffell, beaulebens, hmbashar, illuminea, ironprogrammer, jjj, lopo, louiswol94, mikachan, nerrad, mukesh27, peterwilsoncc, pooja1210, smub, swissspidy.

Fixes #61319.
See #22316, #60992.
Built from https://develop.svn.wordpress.org/trunk@58250


git-svn-id: http://core.svn.wordpress.org/trunk@57713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 14:45:10 +00:00
joedolson
7e59aaf6a9 Media: Remove duplicate CSS from media-views.css.
Remove duplicate CSS from the `media-views.css` file. Follow up to [50829].

Props afercia, joedolson, shailu25.
Fixes #60499.
Built from https://develop.svn.wordpress.org/trunk@58249


git-svn-id: http://core.svn.wordpress.org/trunk@57712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 13:59:09 +00:00
joedolson
e6cfabe956 Media: Protect mime type icon function from simple errors.
Handle `$preferred_ext` arguments that are passed with minor errors in formatting, such as incorrect casing or missing `.`. Add unit tests to verify that an omitted period on an otherwise correct extension is accepted. Follow up to [57687].

Props sabernhardt, joedolson, khokansardar.
Fixes #60610.
Built from https://develop.svn.wordpress.org/trunk@58248


git-svn-id: http://core.svn.wordpress.org/trunk@57711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 13:03:12 +00:00
Pascal Birchler
b2d74b21b9 Editor: Improve types in docblock after [58246].
Makes it clearer that an array of strings is expected.

See #61274.
Built from https://develop.svn.wordpress.org/trunk@58247


git-svn-id: http://core.svn.wordpress.org/trunk@57710 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 08:54:07 +00:00
isabel_brison
6eec46900f Editor: allow registering block styles for multiple block types.
Updates the `WP_Block_Styles_Registry` class to allow registering an array of blocks.

Props aaronrobertshaw, talldanwp, isabel_brison.
Fixes #61274.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 07:35:13 +00:00
isabel_brison
bfab5160b3 Editor: Update util for scoping CSS selectors.
Adds early return for existing scope_selector method in preparation for extending block style variations.

Props aaronrobertshaw, audrasjb, isabel_brison.
Fixes #61120.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 05:22:05 +00:00
isabel_brison
6f9de6388c Editor: Add scoping of feature level global styles selectors.
Ensures that feature-level selectors for block style variations are correctly scoped when generating a theme.json stylesheet.

Props aaronrobertshaw, audrasjb, vcanales, isabel_brison.
Fixes #61119.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 04:40:07 +00:00
isabel_brison
f7515f439f Editor: Negative margins for alignfull children of blocks with custom padding.
Fixes a condition that was preventing align full blocks to extend full width when their parent block has custom padding.

Props richtabor, isabel_brison, ramonopoly.
Fixes #61313.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 04:10:09 +00:00
isabel_brison
1b218aaa39 Editor: add aspect ratio presets support.
Enables customizing the list of aspect ratio options available through theme.json.

Props fabiankaegy, isabel_brison, swissspidy.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 03:10:10 +00:00
isabel_brison
e3f4aa35d8 Editor: level global styles specificity at 0-1-0.
Adjusts the block level global styles selectors so they have a consistent specificity of 0-1-0, and adjusts base and layout global style selectors to their minimum required specificity.

Props aaronrobertshaw, isabel_brison, andrewserong, mukesh27.
Fixes #61165.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-30 01:16:07 +00:00
joedolson
849cb4c172 Media: Accessibility: Make alt text information URL translatable.
Allow translators to replace the W3C WAI decision tree link used to provide information about writing alt text. Improves accessibility for non-English speaking content authors.

Props tmatsuur, joedolson, oglekler, SergeyBiryukov, myhro, sabernhardt.
Fixes #60975.
Built from https://develop.svn.wordpress.org/trunk@58240


git-svn-id: http://core.svn.wordpress.org/trunk@57703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 22:22:14 +00:00
Tammie Lister
4affa3ca71 Twenty Sixteen: Fixes pre element having less padding in the editor.
The verse block has different padding between editor and frontend. 

Props pranitdugad, sumitsingh, sumitbagthariya16, hitendra-chopda, sabernhardt, huzaifaalmesbah, shuvomohajan, hmbashar.
Fixes #61306.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 21:07:10 +00:00
Tammie Lister
e5e0debea4 Twenty Eleven: Resolves padding for media and text block.
The media and test block had misaligned padding. This changes styles to match margins.

Props kajalgohel, nidhidhandhukiya, ironprogrammer, sabernhardt, costdev, huzaifaalmesbah, hmbashar.
Fixes #57195.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57701 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 21:00:13 +00:00
Tammie Lister
2fba811824 Twenty Seventeen: Updates docblock for function.
The new function twentyseventeen_should_show_featured_image was missing documentation for the custom filter. This brings that in.

Props poena.
Fixes #39281.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 19:43:11 +00:00
Pascal Birchler
a22b094047 I18N: Add new lang_dir_for_domain filter.
This new filter in `WP_Textdomain_Registry` allows plugins to override the determined languages folder when using just-in-time translation loading.

Props swissspidy, chouby, johnbillion.
Fixes #61206.
Built from https://develop.svn.wordpress.org/trunk@58236


git-svn-id: http://core.svn.wordpress.org/trunk@57699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 15:44:13 +00:00
Sergey Biryukov
fb9dee1d70 Tests: Use more specific assertions in a few tests.
Follow-up to [121/tests], [915/tests], [34903], [36307], [43548], [44154], [52286], [57337].

See #60705.
Built from https://develop.svn.wordpress.org/trunk@58235


git-svn-id: http://core.svn.wordpress.org/trunk@57698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 12:22:07 +00:00
gziolo
b23d47efe7 Interactivity API: Move directive processing to WP_Block class
Integrates the directives processing into the WP_Block class. It removes the overhead of running additional hooks when rendering blocks and simplifies the way we detect whether the directive processing should run on an interactive region of the produced final HTML for the blocks.

Introduces `interactivity_process_directives` filter to offer a way to opt out from directives processing. It's needed in Gutenberg: https://github.com/WordPress/gutenberg/pull/62095.

Props gziolo, cbravobernal.
Fixes #61185.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 11:57:08 +00:00
dmsnell
b5894d595e HTML API: Fix token length bug in Tag Processor.
The Tag Processor stores the byte-offsets into its HTML document where
the current token starts and ends, and also for every bookmark. In some
cases for tags, the end offset has been off by one.

In this patch the offset is fixed so that a bookmark always properly
refers to the full span of the token it's bookmarking. Also the current
token byte offsets are properly recorded.

While this is a defect in the Tag Processor, it hasn't been exposed 
through the public interface and has not affected any of the working
of the processor. Only subclasses which rely on the length of a bookmark
have been potentially affected, and these are not supported environments
in the ongoing work.

This fix is important for future work and for ensuring that subclasses
performing custom behaviors remain as reliable as the public interface.

Developed in https://github.com/WordPress/wordpress-develop/pull/6625
Discussed in https://core.trac.wordpress.org/ticket/61301

Props dmsnell, gziolo, jonsurrell, westonruter.
Fixes #61301.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 11:42:08 +00:00
gziolo
69d3004bc7 Tests: Update the generated fixture for REST API
Follow-up [58227].
See #61137.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 10:50:08 +00:00
Tammie Lister
a312597d65 Twenty Fifteen: Resolves seperator block being too thick in iframe editor.
The seperator block was looking different in the iframe editor. This resolves that by unifying.

Props nidhidhandhukiya, sabernhardt, darshitrajyaguru97, yuvrajsinj2211.
Fixes #60079.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 09:47:15 +00:00
ellatrix
396851e0ae Options: Add 'label' argument to register_setting.
The 'label' will displayed to users when editing core or custom settings via block editors. It avoids hardcoding Settings labels and improves extensibility.

Backports https://github.com/WordPress/gutenberg/pull/59243.

Props mamaduka, timothyblynjacobs, ellatrix.

Fixes #61023.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 08:53:09 +00:00
Pascal Birchler
d2eed678ab REST API: Remove default text domain from translatable strings after [58227].
See #61137.
Built from https://develop.svn.wordpress.org/trunk@58229


git-svn-id: http://core.svn.wordpress.org/trunk@57692 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 08:23:11 +00:00
ellatrix
6a2b736c2f Theme JSON: Extract util to get valid block style variations.
Extracts the repeated collection of valid block style variations into a util that can be reused or updated in a single place for future work around extending block style variations.

Backports https://github.com/WordPress/gutenberg/pull/61030.

Props aaronrobertshaw, audrasjb.

Fixes #61121.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57691 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 07:46:11 +00:00
youknowriad
780d126082 REST API: Allow view access of template endpoint to anyone with the edit_post capability.
In order to render the block template in the locked template preview inside the post editor we need to be able to fetch the contents of any block templates/template parts for any user role that can edit a post.

Props fabiankaegy, youknowriad.
Fixes #61137.
Built from https://develop.svn.wordpress.org/trunk@58227


git-svn-id: http://core.svn.wordpress.org/trunk@57690 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 07:21:16 +00:00
isabel_brison
0bf7df15f3 Editor: improve consistency of root padding.
Improve the behaviour of global padding when useRootPaddingAwareAlignments is enabled in theme.json to be more consistent across blocks, templates and patterns.

Props richtabor, isabel_brison, andrewserong.
Fixes #61304.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-29 05:15:14 +00:00
Pascal Birchler
87a182ab6f REST API: Refactor global styles endpoints in REST API to register with post type.
Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the `WP_REST_Revisions_Controller`. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the `register_post_type_args` filter.

This reintroduces [57624] (reverted in [57628]) with improved backward compatibility and further enhancements.

Props ramonopoly, spacedmonkey, mukesh27, swissspidy.
Fixes #60131.
Built from https://develop.svn.wordpress.org/trunk@58225


git-svn-id: http://core.svn.wordpress.org/trunk@57688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 12:40:16 +00:00
Sergey Biryukov
61b45944d1 Docs: Clarify that the $wp_error parameter of login_header() is nullable.
Follow-up to [7991], [25701], [28792], [43457], [58209], [58220].

See #60668, #60699.
Built from https://develop.svn.wordpress.org/trunk@58224


git-svn-id: http://core.svn.wordpress.org/trunk@57687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 11:13:12 +00:00
youknowriad
bd5882e27b Toolbar: Update the site editor link in the Admin Bar.
The details page is being removed from the site editor in 6.6. we need to direct the admin bar menu item to the "edit" mode page directly.

Props youknowriad, mamaduka.
Fixes #61266.
Built from https://develop.svn.wordpress.org/trunk@58223


git-svn-id: http://core.svn.wordpress.org/trunk@57686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 08:02:16 +00:00
noisysocks
1284a7fe99 Block Themes: Allow setting site-wide background images in theme.json
Syncs the necessary changes from Gutenberg to allow setting site-wide
background images using the top-level `styles.background` key in `theme.json`.

Props ramonopoly.
Fixes #61123.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 06:06:11 +00:00
Peter Wilson
d66894e50d Build/Test Tools: Assert files exist/do not exist directly.
Replaces various boolean assertions wrapping `file_exists()` with either `assertFileExists()` or `assertFileDoesNotExist()` as appropriate for the test.

Props peterwilsoncc, mukesh27.
See #60705.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57684 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-28 05:27:13 +00:00
audrasjb
477e688d1c Login and Registration: login_header() docblock update after [58209].
This changeset indicates that the `$title` parameter is now nullable.

Follow-up to [58209].

Props skithund.
Fixes #60668.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 21:32:13 +00:00
audrasjb
407584f9ef External Libraries: Revert some unwanted changes after [58218].
This reverts some unwanted changes related to `react` and react-dom` versions in `$vendor_scripts_versions`.

Follow-up to [58218].

Unprops audrasjb.
Fixes #61090.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 21:22:10 +00:00
audrasjb
12541213c1 External Libraries: Update the jQuery UI library to version 1.13.3.
For more information on the changes included, see https://blog.jqueryui.com/2024/04/jquery-ui-1-13-3-released/.

Props audrasjb, desrosj, khokansardar, swissspidy.
Fixes #61090.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 21:14:15 +00:00
joedolson
3b1f9c8c28 Media: Add missing units for length and dimensions in media library.
Include explicit units for media length and dimensions in attachment modal and media details screen.

Props Presskopp, joedolson, shailu25, audrasjb.
Fixes #59009.
Built from https://develop.svn.wordpress.org/trunk@58217


git-svn-id: http://core.svn.wordpress.org/trunk@57680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 19:44:14 +00:00
Pascal Birchler
bba7f1effc Build/Test Tools: Update REST API fixtures after [58211].
See #41172.
Built from https://develop.svn.wordpress.org/trunk@58216


git-svn-id: http://core.svn.wordpress.org/trunk@57679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 19:05:13 +00:00
joedolson
e7afd14793 Toolbar: Accessibility: Fix keyboard focus order of search form.
Change the priority of the search form & remove `float` so that the visual position of the form matches it's positioning in the DOM.

This sets the priority of the search form to an arbitrarily high value of `9999` to ensure it will generally be last in the DOM.

Props joedolson, sabernhardt, audrasjb.
Fixes #60685.
Built from https://develop.svn.wordpress.org/trunk@58215


git-svn-id: http://core.svn.wordpress.org/trunk@57678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 18:41:15 +00:00
joedolson
f07a796aab Media: Improve scale/crop layout in image editor medium breakpoints.
Adjust the max-width of the image edit settings panel so that reflow handling at intermediary breakpoints is more consistent and less fragile.

Props deepakvijayan, huzaifaalmesbah, joedolson, khokansardar.
Fixes #58979.
Built from https://develop.svn.wordpress.org/trunk@58214


git-svn-id: http://core.svn.wordpress.org/trunk@57677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 18:03:13 +00:00
joedolson
68197542eb Themes: Accessibility: Logo block returns empty link when image not set.
The logo block does not use theme mods, and instead saves a site-wide option `site_logo` to use as the site logo. 

Add handling for cases where the logo image does not exist and delete the `site_logo` option when the attachment configured as site logo is deleted.

Props afercia, joedolson, khokansardar, SergeyBiryukov.
Fixes #60922.
Built from https://develop.svn.wordpress.org/trunk@58213


git-svn-id: http://core.svn.wordpress.org/trunk@57676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 16:41:10 +00:00
Sergey Biryukov
f6973306ea Docs: Improve documentation for a few functions accepting a WP_Post object.
Follow-up to [15777], [23769], [24490], [25697], [37252], [49544].

See #60699.
Built from https://develop.svn.wordpress.org/trunk@58212


git-svn-id: http://core.svn.wordpress.org/trunk@57675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 16:29:16 +00:00
Pascal Birchler
b2b6166091 Posts, Post Types: Remove now obsolete hardcoded attachment check for autosave support.
Follow-up to [58201].

Props swissspidy, spacedmonkey.
See #41172.
Built from https://develop.svn.wordpress.org/trunk@58211


git-svn-id: http://core.svn.wordpress.org/trunk@57674 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 15:24:13 +00:00
audrasjb
21b8312b48 Upload: Add missing escaping functions in wp-admin/async-upload.php.
Props nareshbheda, mukesh27.
Fixes #60978.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57673 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 14:31:13 +00:00
audrasjb
fb4fcb4388 Login and Registration: Ensure login header title is translatable.
This changeset ensures the login header default title string is translatable in `login_header()`.

Props juliobox, swissspidy, audrasjb.
Fixes #60668.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57672 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 14:11:12 +00:00
audrasjb
9df0603c96 HTTP API: Improve download_url() error message.
This changeset improves the error message returned when no URL is provided, and updates the related unit tests accordingly.

Props hinnerk, audrasjb.
Fixes #60565.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 13:55:12 +00:00
Tammie Lister
fd798307a0 Twenty Seventeen: Resolves image block caption text alignment inconsitency.
The caption for image block was misaligned. The issue appeared in 5.8 due to the block class name change making the selector meaningless. This is resolved by a change in the selectors.

Props nkeller15, sabernhardt, thakordarshil, anilvaza, shailu25, pavanpatil1, darshitrajyaguru97.
Fixes #58539.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 12:43:11 +00:00
Tammie Lister
b4aa9d18b1 Twenty Seventeen: Add filter for display of featured image in header.
When a layout doesn't use custom post types it was appearing broken. This adds a filter for the display of the featured image to resolve this.

Props justnorris, JPry, davidakennedy, SergeyBiryukov, zkarj, poena, nhrrob, lamarajan.
Fixes #39281.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 12:28:18 +00:00
Tammie Lister
31b37a5eb3 Twenty Twenty: Fixes button link not inheriting custom letter spacing.
The button block link did not inherit the custom letter spacing. This resolves that issue.

Props nidhidhandhukiya, sabernhardt, wesatintellitonic, pooja1210, shailu25.
Fixes #58024.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 10:46:13 +00:00
Tammie Lister
4c8cceb51a Twenty Seventeen: Resolves latest comments author font weight difference.
The latest comments author font weight was showing different between editor and front. This fixes that and also removes an extra ruleset. 

Props pitamdey, sabernhardt, shailu25, naeemhaque, darshitrajyaguru97.
Fixes #61180.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 10:31:11 +00:00
Tammie Lister
57dc7cd16c Twenty Twenty-One: Test failure fix for theme [58202].
Compiling stylesheets to pass tests.

See #52551.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57666 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 10:28:13 +00:00
Tammie Lister
a17042b780 Twenty Twenty-One: Fixes Search Box Alignment.
The search box alignment was not in alignment. This brings in a resolution for that through the margin.

Props vinita29, SergeyBiryukov, poena, shailu25, makdiahussain, imranhasanraaz, darshitrajyaguru97, lamarajan.
Fixes #52551.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 10:04:15 +00:00
Pascal Birchler
3504e15aa9 Posts, Post Types: Autosave: Allow disabling autosave support per post type.
Not all post types support autosaving. By making autosave a post type feature, support can be more granularly handled without any workarounds or hardcoded allowlists. `wp_font_family` and `wp_font_face` are examples of built-in post types which do not support autosave.

For backward compatibility reasons, adding `editor` support implies `autosave` support, so one would need to explicitly use `remove_post_type_support()` to remove it again.

Props swissspidy, youknowriad, hellofromtonya, peterwilsoncc.
Fixes #41172.
Built from https://develop.svn.wordpress.org/trunk@58201


git-svn-id: http://core.svn.wordpress.org/trunk@57664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-27 09:06:16 +00:00
Sergey Biryukov
eba0df8c7b Docs: Correct the placement of @global tags in various files.
Follow-up to [6589], [8598], [10798], [25490], [25594], [31192], [31194], [35718], [37437], [44169], [44948], [45247], [56763], [56773], [57370], [57503].

Props shailu25.
Fixes #61295.
Built from https://develop.svn.wordpress.org/trunk@58200


git-svn-id: http://core.svn.wordpress.org/trunk@57663 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-26 20:51:13 +00:00
Tammie Lister
56ce2e58de Twenty Nineteen: Resolves button block font issues.
The font on buttons was displaying less than the font size when applied through the editor. This resets the relative measurement on wp-block-button__link when either its Buttons or Button block has a custom size.

Props nidhidhandhukiya, sabernhardt, SergeyBiryukov, manojmaharrshi, darshitrajyaguru97, shailu25.
Fixes #56443.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-26 08:49:09 +00:00
Tammie Lister
a9135c617a Twenty Nineteen: Make h1 consistent for entry title.
The h1 for entry-title was not the same between the editor and front end. This fixes that in the by setting wp-block-post-title font sizes together with h2 and combines post-section-dash mixin for both h1 and h2.

Props sabernhardt, nkeller15, shailu25.
Fixes #58440.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-26 08:32:13 +00:00
Sergey Biryukov
5941fea0b3 Docs: Update pre_do_shortcode_tag and do_shortcode_tag filter DocBlocks.
This reflects the return type change of `shortcode_parse_atts()` from `array|string` to `array` in WordPress 6.5.

Follow-up to [38506], [38713], [39665], [55711], [57597], [58168].

Props marherumr.
Fixes #61288.
Built from https://develop.svn.wordpress.org/trunk@58197


git-svn-id: http://core.svn.wordpress.org/trunk@57660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-25 03:04:12 +00:00
Sergey Biryukov
991a96b968 Docs: Add a @since note for the changes to safecss_filter_attr() in WP 6.6.
Follow-up to [58170].

See #61111.
Built from https://develop.svn.wordpress.org/trunk@58196


git-svn-id: http://core.svn.wordpress.org/trunk@57659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-24 09:49:07 +00:00
gziolo
b3e3c8ba32 Interactivity API: Include preact/debug when SCRIPT_DEBUG is enabled
Syncs the changes from Gutenberg: https://github.com/WordPress/gutenberg/pull/60514. Enqueues a different Interactivity API runtime version with preact/debug when SCRIPT_DEBUG is enabled.

Props darerodz, jonsurrell, gziolo.
Fixes #61171.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-24 09:42:09 +00:00
Pascal Birchler
03ed152078 Editor: fix PHP warnings in tests after [58170].
Props peterwilsoncc.
Fixes #61111.
Built from https://develop.svn.wordpress.org/trunk@58194


git-svn-id: http://core.svn.wordpress.org/trunk@57657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-24 08:31:11 +00:00
gziolo
76b498103c Build: Add globalThis DefinePlugin config to webpack
This updates the build to account for related changes in WordPress packages. More details in https://github.com/WordPress/gutenberg/pull/61486.

Props jonsurrell, youknowriad, swissspidy, gziolo.
Fixes #61262.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-24 08:00:11 +00:00
dmsnell
ec7c61e320 HTML API: Add expects_closer() method to HTML Processor
This patch adds a new method, `WP_HTML_Processor->expects_closer()` to indicate
if the currently-matched node expects to find a closing token. For example, a
`DIV` element expects a closing `</div>` tag, but an `<img>` expects none, because
it's a void element. Similarly, `#text` nodes and HTML comments only appear as
unitary nodes on the stack of open elements. Once proceeding further in the
document they are immediately removed without any closing tag.

This new method serves as a helper to indicate whether or not to expect the
closer, as this can be more complicated than it seems, and calling code
shouldn't have to build custom interpretations and implementations. Instead,
the HTML Processor ought to export its internal knowledge to make it easy for
consuming code and projects.

Developed in https://github.com/WordPress/wordpress-develop/pull/6600
Discussed in https://core.trac.wordpress.org/ticket/61257

Fixes #61257.
Props dmsnell, jonsurrell.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57655 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-24 01:21:10 +00:00
dmsnell
07a35d5d41 HTML API: Add method to report depth of currently-matched node.
The HTML Processor maintains a stack of open elements, where every element,
every `#text` node, every HTML comment, and other node is pushed and popped while
traversing the document. The "depth" of each of these nodes represents how deep
that stack is where the node appears. Unfortunately this information isn't
exposed to calling code, which has led different projects to attempt to
calculate this value externally. This isn't always trivial, but the HTML
Processor could make it so by exposing the internal knowledge in a new method.

In this patch the `get_current_depth()` method returns just that. Since the
processor always exists within a context, the depth includes nesting from the
always-present html element and also the body, since currently the HTML
Processor only supports parsing in the IN BODY context.

This means that the depth reported for the `DIV` in `<div>` is 3, not 1, because
its breadcrumbs path is `HTML > BODY > DIV`.

Developed in https://github.com/WordPress/wordpress-develop/pull/6589
Discussed in https://core.trac.wordpress.org/ticket/61255

Fixes #61255.
Props dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57654 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 23:37:12 +00:00
dmsnell
c3b76697cd HTML API: Respect class_name query arg in HTML_Processor::next_tag()
Previously the HTML Process was ignoring the `class_name` argument in
the `next_tag()` query if it existed. This was wrong and would lead to
calling code finding the wrong tag if provided.

This patch adds the class detection code back into `next_tag()` to fix
the bug.

Developed in https://github.com/WordPress/wordpress-develop/pull/6618
Discussed in https://core.trac.wordpress.org/ticket/58517

See #58517.
Follow-up to [56274].
Props: dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 22:45:13 +00:00
ellatrix
3c2e6808c3 Editor: add new block PHP files.
This was forgotten in changeset 58187.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57652 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 19:59:07 +00:00
dmsnell
cbc1c955d8 Introduce Token Map: An optimized static translation class.
This patch introduces a new class: `WP_Token_Map`, designed for efficient
lookup and translation of static mappings between string keys or tokens, and
string replacements (for example, HTML character references).

The Token Map imposes certain restrictions on the byte length of the lookup
tokens and their replacements, but is a highly-optimized data structure for
mappings with a very high number of tokens.

Developed in https://github.com/WordPress/wordpress-develop/pull/5373
Discussed in https://core.trac.wordpress.org/ticket/60698

Fixes #60698.
Props: dmsnell, gziolo, jonsurrell, jorbin.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57651 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 19:56:08 +00:00
ellatrix
1fbf5fa51d Editor: Update npm packages.
Updates the editor npm packages to latest versions.

See https://github.com/WordPress/wordpress-develop/pull/6612.

Props ellatrix, mukesh27, youknowriad, mamaduka.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 19:39:28 +00:00
Bernhard Reiter
031dbe0b4d Block Hooks API: Insert metadata at the same time as hooked blocks.
The Block Hooks UI relies on the `ignoredHookedBlocks` metadata when determining whether to show the toggle in the Site Editor. The problem is that for uncustomized templates we don't add this metadata.

Currently the visitor functions have a default callback of `insert_hooked_blocks` and we only add the metadata when we're writing to the database via an available filter in the template controller.

This changeset creates a new callback which both inserts the hooked blocks and adds the `ignoredHookedBlocks` metadata to the anchor block, and uses this new callback explicitly in the visitor functions that are run upon reading from the database.

We continue to set the `ignoredHookedBlocks` metadata when writing to the database, i.e. this operation happens twice. Although not ideal, this is necessary to cover the following scenarios:

* When the user adds an anchor block within the editor, we still need to add the `ignoredHookedBlocks` meta to it to prevent hooked blocks hooking on to it unexpectedly on the frontend. This is required to keep parity between the frontend and editor.
* When a user writes template data to the database directly through the API (instead of the editor), we need to again ensure we're not inserting hooked blocks unexpectedly.

It is worth noting that with this change, the first hooked block to insert relative to its anchor block will be accepted. Any additional blocks of the same type (e.g. a second `core/loginout` block) trying to hook onto the same anchor block will be ignored, irrespective of the position.

Props tomjcafferkey, bernhard-reiter, gziolo.
Fixes #59574.
Built from https://develop.svn.wordpress.org/trunk@58186


git-svn-id: http://core.svn.wordpress.org/trunk@57649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 18:35:14 +00:00
Joe McGill
bdebc89143 Editor: Remove additional calls to WP_Theme_JSON::_construct.
This improves performance of the  `WP_Theme_JSON_Resolver` class by avoiding redundant construction of `WP_Theme_JSON` objects for each origin.

Props thekt12, joemcgill, swissspidy, audrasjb, oandregal.
Fixes #61112.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57648 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 16:14:13 +00:00
Sergey Biryukov
0d6e7f33c4 Editor: Add excerpt support to the wp_block post type.
The purpose is to enable using the excerpt as a description for user-created patterns on the Site Editor Pattern screens.

This commit backports the original PR from Gutenberg repository:
* [[https://github.com/WordPress/gutenberg/pull/60549|#60549: [Data Views] User patterns: Use excerpt as description]]

Reference: [[https://github.com/WordPress/gutenberg/issues/55244|#55244: Patterns: Add descriptions to user-created patterns]].

Follow-up to [44146], [44150], [50835], [56030].

Props poena, ntsekouras, krupalpanchal.
Fixes #61250.
Built from https://develop.svn.wordpress.org/trunk@58184


git-svn-id: http://core.svn.wordpress.org/trunk@57647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-23 13:41:58 +00:00
Sergey Biryukov
6cb9583d5d Tests: Use assertSame() in navigation fallback tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [56052].

See #60705.
Built from https://develop.svn.wordpress.org/trunk@58183


git-svn-id: http://core.svn.wordpress.org/trunk@57646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-22 15:41:11 +00:00
spacedmonkey
0775b69427 Options, Meta APIs: Introduce wp_prime_network_option_caches() to load multiple network options with a single database request.
WordPress's `get_network_option` function generally makes individual database requests for each network option. While some options are preloaded in `wp_load_core_site_options`, many still require single database calls to the network options table.

Building on the work done in [56445], [56990], and [57013], which introduced the `wp_prime_option_caches` function, this commit adds two new functions: `wp_prime_network_option_caches` and `wp_prime_site_option_caches`. These functions enable developers to pass an array of option names, allowing caches for these options to be primed in a single object cache or database request. If an option is not found, the notoptions cache key is refreshed, preventing unnecessary repeated requests.

The function `wp_prime_site_option_caches` is similar to `get_site_option`, enabling developers to retrieve network options on the current network without needing to know the current network ID. If these functions are called in a non-multisite environment, they fall back to using wp_prime_option_caches.

These functions have been implemented in `wp_load_core_site_options`, `get_site_transient`, and `set_site_transient`.

Props to spacedmonkey, peterwilsoncc, mukesh27, joemcgill.
Fixes #61053.
Built from https://develop.svn.wordpress.org/trunk@58182


git-svn-id: http://core.svn.wordpress.org/trunk@57645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-21 21:38:12 +00:00
Sergey Biryukov
b6b5ffbf9f Tests: Use assertSame() in block support tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Includes renaming a few test classes per the naming conventions.

Reference: [https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#naming-and-organization Writing PHP Tests: Naming and Organization].

Follow-up to [53076], [53085], [54497], [56046], [56614], [57246], [57491].

See #60705.
Built from https://develop.svn.wordpress.org/trunk@58181


git-svn-id: http://core.svn.wordpress.org/trunk@57644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-21 10:33:13 +00:00
spacedmonkey
90de126bd5 Query: Add more context to the split_the_query filter.
Add more context to the `split_the_query` filter by adding two new parameters: '$old_request' and '$clauses'. This enriches the filter with additional information about the SQL query before the query is run, enabling developers to have more context to help decide if a query should be split. 

Props spacedmonkey, shailu25, rcorrales, tillkruess.
Fixes #59514.
Built from https://develop.svn.wordpress.org/trunk@58180


git-svn-id: http://core.svn.wordpress.org/trunk@57643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 21:21:16 +00:00
Tammie Lister
73bb34454d Twenty Twenty-Three: Updates Screenshot.
The screenshot wasn't showing the front view. This now resolves it to fit guidelines. 

Props kafleg, poena, shivashankerbhatta, SergeyBiryukov.
Fixes #56949.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 17:49:17 +00:00
Tammie Lister
cd0b1dde3c Bundled Themes: Removes measurement in px for zero and related fixes.
The measurement in px for zero values is not needed. It does this for Twenty Twenty-One, Twenty Ten, Twenty Eleven and Twenty Nineteen. This also adds short-hand-property-no-redudant-values to Twenty Twenty-One's stylelint rules. Included is removing box-shadow prefixed rules before the standard property in Twenty Ten. Finally, it also removes empty spaces at the ends of lines in Twenty Thirteen, Twenty Nineteen and Twenty Twenty. 

Props ankitmaru, SergeyBiryukov, netweb, mukesh27, ryelle, audrasjb, sabernhardt.
Fixes #53874.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 15:14:16 +00:00
Tammie Lister
15c49cc2ca Twenty Sixteen: Fixes mismatch of visual and DOM order of elements.
In the footer the site info and social menu visual order and DOM order was mismatched. This fixes that and resolves the altering.

Props afercia, joedolson, rcreators, sabernhardt.
Fixes #60496.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 14:42:11 +00:00
Sergey Biryukov
22aa7cb48a Tests: Correct a number of invalid @covers tags.
This resolves a few warnings when running PHPUnit with the code coverage report:
{{{
"@covers WP_Privacy_Requests_List_Table::get_views" is invalid
"@covers WP_Block_Bindings_Registry::register_block_bindings_source" is invalid
"@covers WP_Block_Patterns_Registry::_register_theme_block_patterns" is invalid
}}}

The two removed `@coversDefaultClass` annotations are redundant, as the class name is already included in the individual `@covers` tags. Removing them allows `@covers ::_register_theme_block_patterns` to work as expected, where `_register_theme_block_patterns` is an standalone function, not a class method.

Follow-up to [54215], [56733], [57373], [57562].

See #60705.
Built from https://develop.svn.wordpress.org/trunk@58176


git-svn-id: http://core.svn.wordpress.org/trunk@57639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 14:40:16 +00:00
Sergey Biryukov
1251cb8c5e Coding Standards: Rewrite an empty conditional in get_post_status().
Expand the comment to further clarify the post object check performed.

Follow-up to [58174].

See #59283.
Built from https://develop.svn.wordpress.org/trunk@58175


git-svn-id: http://core.svn.wordpress.org/trunk@57638 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 13:44:15 +00:00
youknowriad
e1034e15f0 Posts: Ensure get_sample_permalink returns the right permalink for auto-draft posts.
The post editor uses the permalink_template property from the posts REST API to render the post slug input or not. For auto-drafts or newly created posts, this property was not set properly. This PR solves by fixing the get_sample_permalink function used to compute this property.

Props youknowriad, mcsf, antonvlasenko, azaozz, peterwilsoncc, andrewserong, hellofromTonya, spacedmonkey.
Fixes #59283.
Built from https://develop.svn.wordpress.org/trunk@58174


git-svn-id: http://core.svn.wordpress.org/trunk@57637 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 09:49:16 +00:00
Peter Wilson
3cdaeae7ab Editor: Fix unit tests for fluid typography CSS.
Fixes a unit test to assert that CSS variables are defined in `:root{}` rather than `body{}`. Fixes a couple of docblocks in the same file.

Follow up to [58171].

Props ramonopoly.
See #61118.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-20 05:24:18 +00:00
Sergey Biryukov
e59e190855 Docs: Add a note that the who parameter in WP_User_Query is deprecated.
Any usage of `'who' => 'authors'` should be updated to use capability queries instead.

Includes documenting the capability query parameters in `wp_dropdown_users()`.

Follow-up to [51943].

Props kkmuffme, swissspidy, SergeyBiryukov.
See #61243.
Built from https://develop.svn.wordpress.org/trunk@58172


git-svn-id: http://core.svn.wordpress.org/trunk@57635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-19 19:53:19 +00:00
isabel_brison
ff2929bf19 Editor: pass fluid typography theme.json settings to wp_get_typography_font_size_value.
Updates `wp_get_typography_font_size_value` to accept an array of theme.json settings instead of a boolean derived from global state.

Props ramonopoly, audrasjb.
Fixes #61118.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-18 23:18:15 +00:00
isabel_brison
ab8cc6dce3 Editor: add column and row spans to grid children.
Adds support for setting spans using `grid-column` and `grid-row` properties on children of blocks with grid layout.

Props isabel_brison, andrewserong, peterwilsoncc, mukesh27.
Fixes #61111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57633 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-18 20:32:17 +00:00
dmsnell
c4ff251f13 Move is_utf8_charset() into functions.php
This caused issues in maintenance mode, and it's not warranted to have
its own module. This will live alongside `_canonical_charset()`, it's
partner function.

Fixes: #61182.
Props: dmsnell, sergeybiryukov, swisspiddy.
Follow-up to: [58148].

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


git-svn-id: http://core.svn.wordpress.org/trunk@57632 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-18 18:22:14 +00:00
Sergey Biryukov
c649fd77bd Shortcodes: Remove redundant variable type check in get_post_galleries().
`shortcode_parse_atts()` always returns an array as of [57597], so the check is no longer needed.

Follow-up to [40070], [57597].

Props david.binda, swissspidy, oglekler.
Fixes #60581.
Built from https://develop.svn.wordpress.org/trunk@58168


git-svn-id: http://core.svn.wordpress.org/trunk@57631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-18 15:21:15 +00:00
joedolson
4b51c9f5d5 Administration: A11y: Hide thickbox close icon from screen readers.
Add `aria-hidden="true"` to the dashicon symbol used as the `close` icon in Thickbox modals. Prevent the icon from being read as a replacement character by screen readers.

Props stevejonesdev, sabernhardt, joedolson.
See #61028.
Built from https://develop.svn.wordpress.org/trunk@58167


git-svn-id: http://core.svn.wordpress.org/trunk@57630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-17 20:30:15 +00:00
desrosj
3ac0cb9fce Build/Test Tools: Convert GitHub action workflows into reusable ones.
With a few exceptions, GitHub Actions workflows run using the version of the workflow file present in the commit SHA or Git ref for the triggering event. This is useful for maintaining different versions of a workflow file.

In the case of WordPress where there are currently 25+ branches that could potentially receive a security fix, it creates a huge maintenance burden. When 3rd party actions are updated or features are deprecated on GitHub Actions, the required changes need to be backported to all of those branches. This takes considerable time and effort.

This change converts Core’s workflow files to reusable ones. This allows the same workflow to be used for all (or most) branches, allowing the described maintenance updates to be made once in `trunk`.

To keep track of which files are reusable vs. those that are responsible for holding the strategy matrix for that branch, reusable workflows are now prefixed with `reusable-`.

Props johnbillion, swissspidy, jorbin, desrosj.
Fixes #61213.
Built from https://develop.svn.wordpress.org/trunk@58165


git-svn-id: http://core.svn.wordpress.org/trunk@57628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-17 17:43:13 +00:00
Sergey Biryukov
8c878056d5 Tests: Remove trailing characters from @ticket annotations.
Follow-up to [44693], [46209], [54230], [54733], [55151].

Props jonsurrell.
See #61238.
Built from https://develop.svn.wordpress.org/trunk@58164


git-svn-id: http://core.svn.wordpress.org/trunk@57627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-17 13:13:16 +00:00
Pascal Birchler
802fa72d10 Script Loader: Update failing test after [58162].
See #60962.
Built from https://develop.svn.wordpress.org/trunk@58163


git-svn-id: http://core.svn.wordpress.org/trunk@57626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-16 17:26:11 +00:00
Pascal Birchler
4a4b9a6493 Script Loader: Disable injectPolyfill flag in webpack config.
This is a follow-up to [57981] to ensure that `wp-polyfill` is no longer automatically added as a dependency to package scripts. This avoids unnecessarily loading the polyfill script in places such as the block editor.

See #60962.
Built from https://develop.svn.wordpress.org/trunk@58162


git-svn-id: http://core.svn.wordpress.org/trunk@57625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-16 16:44:11 +00:00
Aaron Jorbin
a91012a34b Plugins: Assign role of button to links that act as buttons.
Clicking on these links initiates an action, so they are more semantically a button rather than a link. Keeping them as an anchor in html allows any existing JS that is targeted to these items to continue to function. The addition of the role helps assistive technology to know that they should treat this as a button.

Props stevejonesdev, sabernhardt, vipulgupta003, rcreators, joedolson.
Fixes #61011.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-16 15:31:12 +00:00
Sergey Biryukov
fdbe1f11a5 Tests: Use assertSame() in block_has_support() tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [56382].

See #60706.
Built from https://develop.svn.wordpress.org/trunk@58160


git-svn-id: http://core.svn.wordpress.org/trunk@57623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-16 15:15:13 +00:00
dmsnell
a3b5efe883 Improve legibility of JSON-encoded Interactivity API store data.
The Interactivity API has been rendering client data in a SCRIPT element with the
type `application/json` so that it's not executed as a script, but is available
to one. The data runs through `wp_json_encode()` and is encoded with some flags
to ensure that potentially-dangerous characters are escaped.

However, this can lead to some challenges. Eagerly escaping when not necessary
can make the data difficult to comprehend when reading the output HTML. For example,
all non-ASCII Unicode characters are escaped with their code point equivalent.
This results in `\ud83c\udd70` instead of `🅰`.

In this patch, the flags for JSON encoding are refined to ensure what's necessary
while relaxing other rules (leaving in those Unicode characters if the blog charset
is UTF-8). This makes for Interactivity API data that's quicker as a human reader
to decipher and diagnose.

In summary:

 - This data is JSON encoded and printed in a `<script type="application/json">` tag.

 - If we ensure that `<` is never printed inside the data, it should be impossible to
   break out of the script tag and the browser treats everything as the element's `textContent`.

 - All other escaping becomes unnecessary at that point, including unicode escaping 
   if the page uses the UTF-8 charset (the same encoding as JSON).

See https://github.com/WordPress/wordpress-develop/pull/6433#pullrequestreview-2043218338

Developed in https://github.com/WordPress/wordpress-develop/pull/6520
Discussed in https://core.trac.wordpress.org/ticket/61170

Fixes: #61170
Follow-up to: [57563].
Props: bjorsch, dmsnell, jonsurrell, sabernhardt, westonruter.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-15 17:42:10 +00:00
desrosj
ad15b88403 Build/Test Tools: Remove version from docker-compose.yml.
The `version` property throws a warning when working with the local Docker environment. According to the Docker Compose spec, the property only remains for backward compatibility and should be removed.

Props narenin, mukesh27, swissspidy.
Fixes #61101.
Built from https://develop.svn.wordpress.org/trunk@58157


git-svn-id: http://core.svn.wordpress.org/trunk@57620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-15 15:35:10 +00:00
Pascal Birchler
3c38870487 Docs: Improve docblock for WP_REST_Template_Revisions_Controller::get_parent().
Props rockfire.
See #60699, #61113.
Built from https://develop.svn.wordpress.org/trunk@58156


git-svn-id: http://core.svn.wordpress.org/trunk@57619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-15 11:18:12 +00:00
Pascal Birchler
c4dc645821 Docs: Fix incorrect docblock for WP_Translation_Controller::translate_plural.
Props szepeviktor.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@58155


git-svn-id: http://core.svn.wordpress.org/trunk@57618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-15 09:07:11 +00:00
Sergey Biryukov
f695d7f8b9 Tests: Use assertSame() in absint() tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Includes correcting a few erroneously duplicated test cases to match their intended purpose.

Follow-up to [57724].

See #60706.
Built from https://develop.svn.wordpress.org/trunk@58150


git-svn-id: http://core.svn.wordpress.org/trunk@57615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-15 01:09:10 +00:00
audrasjb
d4ef1a6cd5 Administration: Add primary class to the FTP credentials modal submit button.
This helps differentiate the two buttons available in the FTP credentials modal by setting a `primary` class to the submit button.

Props mapk, curdin, audrasjb, shailu25.
Fixes #37647.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 22:17:13 +00:00
dmsnell
06a25caf23 Quick-fix: Normalize UTF-8 charset slug detection.
In the merge of [58417] the new file was missed. This commit adds the missing required file.

Developed in https://github.com/WordPress/wordpress-develop/pull/6535
Discussed in https://core.trac.wordpress.org/ticket/61182

Fixes #61182.
Follow-up to [58147].
Props dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57613 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 18:07:07 +00:00
dmsnell
d30cd41ed4 Normalize UTF-8 charset slug detection.
There are several exist places in Core that attempt to detect if a blog charset
is UTF-8. Each place attempts to perform the same check, except the logic is
spread throughout and there's no single method provided to make this
determination in a consistent way. The `_canonical_charset()` method exists,
but is marked private for use.

In this patch the new `unicode` module provides `is_utf8_charset()` as a method
taking an optional charset slug and indicating if it represents UTF-8,
examining all of the allowable variants of that slug. Associated code is
updated to use this new function, including `_canonical_charset()`. If no slug
is provided, it will look up the current `get_option( 'blog_charset' )`.

Finally, the test functions governing `_canonical_charset()` have been
rewritten as a single test with a data provider instead of as separate test
functions.

Developed in https://github.com/WordPress/wordpress-develop/pull/6535
Discussed in https://core.trac.wordpress.org/ticket/61182

Fixes #61182.
Props dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 18:05:11 +00:00
joedolson
79045fa10e Administration: A11y: Replace placeholders with visible labels.
Add visible labels to inputs that are using placeholder attributes as a substitute for visible labeling.

Labels added or made visible on the customizer theme search, customizer widget search, customizer menu item search, customizer new page UI, the search plugins screens, the media search screens, and the classic editor link inserter.

Props afercia, joedolson, rcreators, sabernhardt.
See #40331.
Built from https://develop.svn.wordpress.org/trunk@58146


git-svn-id: http://core.svn.wordpress.org/trunk@57611 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 16:49:09 +00:00
Sergey Biryukov
f57368d7ed Users: Reuse an existing string in the confirmation for unsaved changes in user profile.
Follow-up to [58137].

Fixes #40493.
Built from https://develop.svn.wordpress.org/trunk@58145


git-svn-id: http://core.svn.wordpress.org/trunk@57610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 16:14:11 +00:00
desrosj
c2628e70d8 Build/Test Tools: Don’t upload HTML reports to Codecov.
When generating a human readable code coverage report in HTML format, the Codecov action used to fail silently. An error is now being returned, resulting in a workflow failure.

This adds a skip condition to the appropriate steps so the coverage report is only uploaded when a `clover` format is generated.

See #60733.
Built from https://develop.svn.wordpress.org/trunk@58144


git-svn-id: http://core.svn.wordpress.org/trunk@57609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-14 15:20:13 +00:00
Weston Ruter
9702c2e265 Embeds: Enable lazy-loading of post embeds and fix keyboard a11y for hidden iframes.
Chrome unreliably loads a lazy-loaded iframe when it is hidden using `clip: rect(1px, 1px, 1px, 1px)`. Instead of using `clip`, a lazy-loaded iframe can also be hidden with `visibility:hidden` which results in it loading not only in Chrome but all other browsers. With this change applied, the hard-coded check to prevent lazy-loading post embeds is now removed. An added benefit to using `visibility:hidden` is that the entire iframe in this case is not interactable, meaning that users navigating the document with the keyboard will not unexpectedly encounter tab stops inside of the hidden iframe, as can happen now with `clip` when the JS fails to reveal the loaded iframe. Note also that the `clip` property is deprecated.

Lastly, when such a post embed iframe is rendered in an RSS feed, the `style` attribute is now removed using the HTML Tag Processor as opposed to using string replacement.

Fixes #58773.
Props westonruter, joemcgill, swissspidy, joedolson, adamsilverstein.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 22:39:16 +00:00
Tammie Lister
922c74ac70 Twenty Twenty-One: Fixes primary menu disappearing.
The primary menu was disappearing at 481px. This adjusts to resolve this. It was shown when adjust the browser window not in responsive design mode.

Props stephenbrook, audrasjb, mukesh27, sabernhardt, poena, kristenfisher427, siliconforks, jwgoedert, joedolson.
Fixes #52354.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57607 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 16:43:08 +00:00
Aaron Jorbin
e224be969e Tests: Add comment to explain when e2e test for gutenberg is skipped
Follow-up to [58046].

See #60971.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 16:40:11 +00:00
Sergey Biryukov
f29b58aa91 Docs: Make Settings API documentation link clickable in wp-admin/options.php.
The link is a part of the deprecation notice displayed when saving an unregistered setting.

Follow-up to [13646], [13785], [14070], [32116], [34315], [45674].

Props timse201, sabernhardt, amitraj2203, khokansardar, SergeyBiryukov.
Fixes #61199.
Built from https://develop.svn.wordpress.org/trunk@58140


git-svn-id: http://core.svn.wordpress.org/trunk@57605 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 16:26:10 +00:00
John Blackbourn
87ba206026 Bootstrap/Load: Place the debugging output for automatic plugin and theme updates behind a debugging flag.
This change means this debugging output will only be shown when both the `WP_DEBUG` and `WP_DEBUG_LOG` constants are defined as true.

Props costdev, afragen, swissspidy

Fixes #58281

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


git-svn-id: http://core.svn.wordpress.org/trunk@57604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 15:24:11 +00:00
John Blackbourn
a59eb9d39c Bootstrap/Load: Update the domain parsing when initialising the cookie domain on Multisite.
This ensures the cookie domain is set to the bare domain without a port number, if one is present.

Props spacedmonkey

Fixes #21077

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


git-svn-id: http://core.svn.wordpress.org/trunk@57603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-13 13:34:11 +00:00
joedolson
39c3bec9f3 Users: Add JS confirmation if user profile has unsaved changes.
Add a confirmation dialog when users navigate away from the user profile screen if they have unsaved changes to prevent data loss.

Props ashokrane, karlijnbk, diedeexterkate, jwgoedert, joedolson, swissspidy, afercia.
Fixes #40493.
Built from https://develop.svn.wordpress.org/trunk@58137


git-svn-id: http://core.svn.wordpress.org/trunk@57602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-12 18:45:14 +00:00
Sergey Biryukov
fd4159ed87 Tests: Move add_settings_section() tests to a more appropriate place.
Follow-up to [54247].

See #60705.
Built from https://develop.svn.wordpress.org/trunk@58136


git-svn-id: http://core.svn.wordpress.org/trunk@57601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-12 15:56:09 +00:00
Tammie Lister
f38ec10f21 Twenty Seventeen: Resolves Header Image Quality Issue
The heading image had quality issues on iOS Safari in portrait and landscape modes. This resolves it through adding 200cv for smaller screens so less than full size.

Props poena, richardevs, laurelfulford, davidakennedy, joemcgill, SergeyBiryukov, ianbelanger, sabernhardt, shailu25, robertghetau.
Fixes #39253.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57600 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-12 09:29:09 +00:00
Peter Wilson
048c5ba580 Options, Meta APIs: Prime transient options prior to use.
Reduce the number of queries getting and setting transients on sites without a persistent cache. 

Transients are stored in two options: one each for the transient value and timeout. Priming the cache reduces the database queries for getting a transient from two to one.

Props peterwilsoncc, swissspidy.
Fixes #61193.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57599 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-11 23:53:15 +00:00
joedolson
77073cce6b Toolbar: Accessibility: Remove adminbar skiplink focus fix.
Based on the current browser support policies and expectations, this is no longer needed. There are almost no browsers in use where this is still in use. The same fix was removed from core themes in #54421.

Props joedolson, sabernhardt, shailu25.
Fixes #60479.
Built from https://develop.svn.wordpress.org/trunk@58133


git-svn-id: http://core.svn.wordpress.org/trunk@57598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-11 18:28:08 +00:00
Sergey Biryukov
13f85f2cd2 Docs: Update a HelpHub link on Edit Site screen to avoid unnecessary redirection.
Follow-up to [17045], [20713], [41065], [45674], [55412], [57854], [58131].

Props shailu25.
See #60732, #60699.
Built from https://develop.svn.wordpress.org/trunk@58132


git-svn-id: http://core.svn.wordpress.org/trunk@57597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-11 14:47:06 +00:00
Sergey Biryukov
447840fc0d Docs: Use more specific URLs for a few Network Admin HelpHub links.
This better reflects the originally intended destination of these links.

Follow-up to [57854].

See #60732, #60699.
Built from https://develop.svn.wordpress.org/trunk@58131


git-svn-id: http://core.svn.wordpress.org/trunk@57596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-11 14:38:13 +00:00
Pascal Birchler
960c3631e4 REST API: Ensure attachments are uploaded to the post's year/month folder.
If organizing uploads into month- and year-based folders, uploading an attachment to an existing post should store the file in `wp-content/uploads/<year>/<month>` based on the post's publish date. This is in line with the behavior in classic editor / the media modal.

Props swissspidy, adamsilverstein, timothyblynjacobs, skithund, sergeybiryukov, patricia70.
Fixes #61189.
Built from https://develop.svn.wordpress.org/trunk@58130


git-svn-id: http://core.svn.wordpress.org/trunk@57595 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-10 18:59:11 +00:00
Sergey Biryukov
8839c33306 Posts, Post Types: Use a consistent plural form of “status” in variable names.
Follow-up to [5575], [6796], [6993], [7638], [12162], [12719], [15578], [16652], [31046], [34515], [49472].

Props Presskopp, sabernhardt, manfcarlo, SergeyBiryukov.
Fixes #58134.
Built from https://develop.svn.wordpress.org/trunk@58129


git-svn-id: http://core.svn.wordpress.org/trunk@57594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-10 18:09:15 +00:00
John Blackbourn
1e8d651f23 Upgrade/Install: Automatically roll back to the previous version when an automatic plugin update results in a fatal error on the front end of the site.
This builds on the temporary backup system introduced in 6.3 to allow automatic updates to benefit from fatal error protection. A loopback request is performed to the home page of the site and the plugin is rolled back to its backed up version if a fatal error is observed.

For debugging and observability during beta, this change includes several calls to `error_log()` during the upgrade and rollback stages. These calls can be removed or placed behind a flag once we're ready for RC1.

Props costdev, johnbillion, mukesh27, afragen, audrasjb, justlevine, kirasong, peterwilsoncc

Fixes #58281

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


git-svn-id: http://core.svn.wordpress.org/trunk@57593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-10 11:48:15 +00:00
gziolo
6edbf28fec Interactivity API: Cannot be used from wp-admin
Interactivity API has hooks that run on the frontend, but not in wp-admin. This means that interactivity data was not printed to the HTML and the interactivity Script Modules were not registered.

Fixes #61087.
Props jonsurrell, cbravobernal, gziolo.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-10 09:13:05 +00:00
gziolo
1953f53b01 Script Modules: Hooks are not registered in wp-admin
Script Modules cannot be used in wp-admin. The necessary hooks are registered on wp_head or wp_footer, but should also be registered for the admin variants so that modules can be used from wp-admin.

Fixes #61086.
Props jonsurrell, cbravobernal, gziolo.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-10 09:09:17 +00:00
John Blackbourn
9817081728 Bootstrap/Load: Take the port number into consideration when determining whether a subdomain installation of Multisite is allowed.
This results in the prevention of an installation running on a port on localhost (for example `localhost:8889`) being converted to a subdomain Multisite installation, whereas previously it was incorrectly allowed.

Props spacedmonkey 

See #21077

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


git-svn-id: http://core.svn.wordpress.org/trunk@57590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-09 23:09:13 +00:00
Sergey Biryukov
1a20e9cc6a Coding Standards: Use strict comparison in wp-includes/nav-menu-template.php.
Includes correcting a conditional in `_wp_menu_item_classes_by_context()` where `$parent_item->object`, which contains a string like `page`, was erroneously compared to the queried object's ID. The correct property to compare is `$parent_item->object_id`.

Follow-up to [14876], [14923], [14942], [15302], [16731], [16742], [22302], [47550], [47557], [47808].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.
Built from https://develop.svn.wordpress.org/trunk@58124


git-svn-id: http://core.svn.wordpress.org/trunk@57589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-09 15:16:14 +00:00
isabel_brison
00b440c27d Editor: move global CSS custom properties to :root selector.
Changes the rules outputting global styles CSS custom properties to use `:root` instead of `body`, and cleans up some unused variables.

Props ramonopoly, isabel_brison.
Fixes #61135.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57588 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-09 04:09:13 +00:00
spacedmonkey
5208140670 Query: Improve cache key generation.
Query caching in `WP_Query` was added in [53941]. When this functionality was added to the `WP_Query` class, a number of edge cases were missed that would result in redundant duplicate queries. It was possible to pass parameters to `WP_Query` that would be different but would result in the same database query being generated. As the cache key is generated from a mixture of query arguments and the SQL query, this resulted in different cache keys for the same database query, resulting in unnecessary duplicate queries. In this change, the logic in the `generate_cache_key` method has been improved to ensure reuse of existing caches. The following edge cases have been considered:

- Passing `post_type` as an empty string.
- Passing `post_type` as the string `any`.
- Passing `post_type` as array vs. string.
- Passing `post_type` as an array in a different order.
- Not passing `orderby`.
- Passing `post_status` as an array vs. string.
- Passing `post_status` as an array in a different order.

This change also fixes an issue where the old SQL query would not match, as the queries had different whitespaces. 

Props spacedmonkey, joemcgill, pbearne, peterwilsoncc, rajinsharwar, mukesh27, thekt12, huzaifaalmesbah, rodionov201.
Fixes #59442.
Built from https://develop.svn.wordpress.org/trunk@58122


git-svn-id: http://core.svn.wordpress.org/trunk@57587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-08 22:51:18 +00:00
Aaron Jorbin
a5d1d98ce0 Readme: Avoid a redirect by using www.php.net
Props josevarghese.
Fixes #61174.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57586 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-08 22:06:14 +00:00
desrosj
a7a6032b46 Build/Test Tools: Remove check-latest input for setup-node.
The `check-latest` setting is used to ensure the latest version of Node.js is always installed in GitHub Action workflows.

This input was added and turned on in [57212] when the minimum required version of Node.js was bumped to `20.10.0`. Because GitHub Action runner image updates are deployed on a rolling basis over the course of several days, a version of Node.js that met this new requirement was not always present (especially on Windows runners). Using this input was a temporary fix to ensure stability for Core’s test workflows. 

The `check-latest` input does have some side effects. Two examples are:
- An additional request is performed to check the latest version every time `setup-node` is used with this option enabled. More requests are made to download and install a newer version of Node.js when one is available.
- When new versions of Node.js are released, the Core workflows immediately switch to the new version, which could potentially have undiscovered bugs or regressions.

The latter has surfaced today due to a regression in Node.js 20.13.0 on Windows (see https://github.com/nodejs/node/issues/52884).

A bit of time has passed and a version >=20.10.0 is now reliably available on all GitHub Action runners. Running the very latest release Node.js is also not important for Core’s testing setup, so `check-version` can safely be removed to address both side effects detailed above. 

Props johnbillion.
Fixes #60129.
Built from https://develop.svn.wordpress.org/trunk@58120


git-svn-id: http://core.svn.wordpress.org/trunk@57585 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-08 19:18:13 +00:00
Sergey Biryukov
c6313e4bcf Coding Standards: Use strict comparison in wp-includes/nav-menu.php.
Follow-up to [14248], [14285], [14878], [15008], [22235], [23897], [23941], [27150].

Props dhruvang21, aristath, poena, afercia, SergeyBiryukov.
Fixes #61160. See #60700.
Built from https://develop.svn.wordpress.org/trunk@58119


git-svn-id: http://core.svn.wordpress.org/trunk@57584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-08 18:37:14 +00:00
johnjamesjacoby
c894dca658 Multisite: Add missing "contribute.php" file to User Dashboard.
This changeset adds a `wp-admin/user/contribute.php` file to allow the "Get Involved" link to work on User Admin.

This changeset prevents an unintended 404 that occurs when a logged-in user clicks the "Get Involved" link (located in the menu-bar) from inside of the multisite-specific User Dashboard.

Related: r56220, r56309, #23348.

Props ignatiusjeroe, audrasjb, tobiasbg.

Fixes #61122.
Built from https://develop.svn.wordpress.org/trunk@58118


git-svn-id: http://core.svn.wordpress.org/trunk@57583 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-08 17:04:13 +00:00
Sergey Biryukov
bcff9a2fe4 Site Health: Correct the anchor for “Learn more about page cache” link.
Follow-up to [54043], [55412], [57793].

Props comecaramelos.
Fixes #61159.
Built from https://develop.svn.wordpress.org/trunk@58113


git-svn-id: http://core.svn.wordpress.org/trunk@57578 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-07 10:17:14 +00:00
Sergey Biryukov
97c3f24034 Editor: Check that attrs is an array in WP_Block_Supports::apply_block_supports().
This prevents a fatal error in `wp_apply_custom_classname_support()`, which expects an array data type for block attributes, and makes sure the block editor can still load if there is a mistake in the attributes of a block.

Follow-up to [54498].

Props caercam.
Fixes #61151.
Built from https://develop.svn.wordpress.org/trunk@58112


git-svn-id: http://core.svn.wordpress.org/trunk@57577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 21:25:15 +00:00
Tammie Lister
558b8897e6 Bundled Themes: Add descriptions to patterns.
This adds descriptions to multiple bundled themes. All patterns without the "Inserter" parameter set to "false" or "no", should use the description parameter (These patterns are hidden in the block inserter and do not use the descriptions).

Props poena, StringPiggy, oglekler, audrasjb, huzaifaalmesbah, swisspidy.
Fixes #59688.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 20:32:15 +00:00
Joe McGill
4f98bf32cf Docs: Update docblock for wp_get_attachment_image() attributes.
This updates the docblock attributes for `wp_get_attachment_image()` to account for attribute values that are being determined by `wp_get_loading_optimization_attributes()`. Updates docs for `$attr['loading']` and adds docs for `$attr['fetchpriority']`.

Props joemcgill, dmsnell.
Fixes #59550.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57575 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 20:23:14 +00:00
John Blackbourn
e04a32b62f Cron API: Add tests for associative and indexed array arguments when rescheduling a cron event.
Props johnbillion, peterwilsoncc

See #57271

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


git-svn-id: http://core.svn.wordpress.org/trunk@57574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 18:49:11 +00:00
John Blackbourn
4d811aac68 Build/Test Tools: Standardise the assertions for remote HTTP request tests.
This ensures that as much information as possible is shown when an HTTP request fails during an external HTTP test.

Fixes #61148

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


git-svn-id: http://core.svn.wordpress.org/trunk@57573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 18:41:12 +00:00
John Blackbourn
eef77dce83 Build/Test Tools: Exclude PHP translation files from phpcs linting.
Translation files in this directory are automatically generated and are not subject to any linting considerations.

See #59647

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


git-svn-id: http://core.svn.wordpress.org/trunk@57572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 18:37:16 +00:00
Tammie Lister
78362d0193 Twenty Twenty-Four: Resolve accessibility issues in FAQ pattern.
The FAQ pattern uses multiple details blocks in a row. This ends up with it behaving as an accordion and opens to issues.  In ticket discussion this was decided to be removed to set a good example of how to build.

Props poena, alh0319, abditsori, richtabor, joedolson, huzaifaalmesbah, krupajnanda, luminuu, shailu25, swisspidy.
Fixes #60335.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 16:40:11 +00:00
Joe McGill
ae2ce86cf4 Options: Update default autoload values used in core.
This updates the values used for the `$autoload` parameter in various functions to replace 'yes' and 'no' with 'on' and 'off', respectively.

Follow-up to [57920].

Props pbearne, mukesh27, joemcgill.
Fixes #61045. See #42441.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 16:35:19 +00:00
Tammie Lister
70ba8a1e2c Twenty Twelve: Pullquote block alignment correction for margins.
The pullquote wasn't aligning correctly centrally. This fixes that issue by adding that in.

Props umesh84, poena, nithins53, adeltahri, bgoewert, sabernhardt.
Fixes #57472.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 15:41:15 +00:00
Tammie Lister
ee10ddb605 Twenty Thirteen: Updates table font size in editor and front.
The table font size wasn't reflecting in editor and front. What this does is keep the default and adds in an inherit.

Props umesh84, desrosj, shailu25, harshgajipara, darshitrajyaguru97, itpathsolutions.
Fixes #56204.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 14:02:12 +00:00
Tammie Lister
28e8f39f15 Twenty Nineteen: Test failure fix for theme [58101].
Patching print file to get to pass tests after diff file fix. Newline patch.

Props swisspidy.
See #45944

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


git-svn-id: http://core.svn.wordpress.org/trunk@57567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 12:57:13 +00:00
Tammie Lister
5bfdb7e938 Twenty Nineteen: Attempt to fix resolve failures cause by [58100].
This aligns print css to be the same as the scss file. This was suggested by failing tests.

Props swisspidy.
See #45944

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


git-svn-id: http://core.svn.wordpress.org/trunk@57566 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 12:50:15 +00:00
Tammie Lister
faae6b565b Twenty Nineteen: Adds URL in for print css.
The print styles is meant to append the URL to links. These rules weren't working correctly and this refreshed patch resolves that.

Props kjellr, laurelfulford, sabernhardt, poena, shailu25.
Fixes #45944.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-06 11:11:14 +00:00
Sergey Biryukov
0b17c7e5f4 Coding Standards: Remove extra conditional in is_super_admin().
Follow-up to [12612].

Props dhruvang21, ankit-k-gupta, audrasjb.
Fixes #61098.
Built from https://develop.svn.wordpress.org/trunk@58099


git-svn-id: http://core.svn.wordpress.org/trunk@57564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-05 14:35:19 +00:00
John Blackbourn
d2434ccaa9 Networks and Sites: Add a clearer warning message before deleting a site from a network.
Props johnjamesjacoby, kebbet, cafenoirdesign, Mista-Flo, johnbillion

Fixes #51358

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


git-svn-id: http://core.svn.wordpress.org/trunk@57563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 22:12:15 +00:00
John Blackbourn
9feb8a6925 Bootstrap/Load: Add support for custom ports in multisite site addresses.
This allows a Multisite network to use an address that includes a port name, such as `example.com:1234`, and adds support for this to the local development environment too. You can now run a Multisite installation on the local development environment, for example at `localhost:8889`.

This also fixes some bugs with running a single site installation on a port, and updates the testing infrastructure so that the whole test suite runs both with and without a port number.

Props djzone, scribu, nacin, ipstenu, F J Kaiser, jeremyfelt, johnjamesjacoby, spacedmonkey, PerS, Clorith, Blackbam, enrico.sorcinelli, Jules Colle, obliviousharmony, desrosj, johnbillion

Fixes #21077, #52088
Built from https://develop.svn.wordpress.org/trunk@58097


git-svn-id: http://core.svn.wordpress.org/trunk@57562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 19:25:10 +00:00
Sergey Biryukov
2637a3d194 Feeds: Add an optional $post parameter to get_the_title_rss().
This allows the function to be used outside of the loop and brings parity with `get_the_title()`.

Follow-up to [1976], [3314], [21735].

Props khokansardar, oglekler.
Fixes #61139.
Built from https://develop.svn.wordpress.org/trunk@58096


git-svn-id: http://core.svn.wordpress.org/trunk@57561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 19:11:11 +00:00
John Blackbourn
900b4b22fa I18N: Pass the $locale variable to the load_translation_file filter.
This avoids the need for the locale to be recalculated by code that hooks into this filter.

Props swissspidy, mukesh27, johnbillion

Fixes #61108

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


git-svn-id: http://core.svn.wordpress.org/trunk@57560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 17:27:09 +00:00
John Blackbourn
6ad45a93a1 Site Health: Improve the internationalisation of strings used in disk space health checks.
This allows the disk space values to be changed in the future without requiring a string change.

Props afragen, audrasjb, johnbillion

Fixes #61115

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


git-svn-id: http://core.svn.wordpress.org/trunk@57559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-04 17:23:16 +00:00
Sergey Biryukov
0888e755d7 Login and Registration: Check that post_password is a string in wp-login.php.
This prevents a fatal error if an array is passed instead.

Follow-up to [19925], [34909], [58023].

Props dd32, swissspidy.
Fixes #61136.
Built from https://develop.svn.wordpress.org/trunk@58093


git-svn-id: http://core.svn.wordpress.org/trunk@57558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 14:32:17 +00:00
desrosj
f878bb85e5 Build/Test Tools: Remind contributors to include a Trac ticket link.
Contributing to WordPress using `wordpress-develop` on GitHub is a useful way collaborate, test, and review suggested changes to the code base. One of the required criteria, though, is including a link to a corresponding Trac ticket. This ensures the PR and associated activity is listed on the Trac ticket, which serves as the source of truth.

It’s easy to forget this and newer contributors aren’t always aware of this requirement. This adds a GitHub Actions job that will add a comment as a reminder when no Trac ticket is included.

Is the waiting really ended? Two thousand years.

Props anamarijapapic, peterwilsoncc.
Fixes #60129.
Built from https://develop.svn.wordpress.org/trunk@58092


git-svn-id: http://core.svn.wordpress.org/trunk@57557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 12:39:14 +00:00
Pascal Birchler
2f433c59f8 Embeds: Add Bluesky as a trusted oEmbed provider.
Props swissspidy, thelovekesh, peterwilsoncc, bnewboldbsky.
Fixes #61020.
Built from https://develop.svn.wordpress.org/trunk@58091


git-svn-id: http://core.svn.wordpress.org/trunk@57556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 07:58:15 +00:00
isabel_brison
1c20a0a820 Editor: Fix coding standards and move deprecated function to correct file.
Follow-up to [58074], formats docblocks correctly and moves `wp_render_elements_support` to the deprecated file.

Props aaronrobertshaw, isabel_brison, mukesh27, spacedmonkey.
See #60681.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 05:25:12 +00:00
isabel_brison
629273d54f Editor: add Style Engine support for nested CSS rules.
Adds support for passing a `$rules_group` string to wp_style_engine_get_stylesheet_from_css_rules(), so rules can be nested under a media query, layer or other rule.

Props isabel_brison, ramonopoly.
Fixes #61099.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-03 04:47:12 +00:00
John Blackbourn
b83d7e4589 Docs: Revert the documentation change to WP_Block_Parser::parse() made in [58084].
This file needs to be synced from the Gutenberg repository.

See #60699
Built from https://develop.svn.wordpress.org/trunk@58085


git-svn-id: http://core.svn.wordpress.org/trunk@57550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 20:09:15 +00:00
John Blackbourn
17debfe624 Docs: Document the array shapes for parsed blocks, template part areas, and template types.
See #60699
Built from https://develop.svn.wordpress.org/trunk@58084


git-svn-id: http://core.svn.wordpress.org/trunk@57549 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 19:54:13 +00:00
Sergey Biryukov
137f90ef49 Docs: Add missing documentation for various upgrade/install class methods.
Follow-up to [13602], [13686], [14879], [25806], [28495], [32655], [48661], [53952].

Props yagniksangani, audrasjb, SergeyBiryukov.
Fixes #61124.
Built from https://develop.svn.wordpress.org/trunk@58082


git-svn-id: http://core.svn.wordpress.org/trunk@57547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 17:20:10 +00:00
Aaron Jorbin
18d2736d35 Plugins: Show an admin notice on successful activation.
Plugin activation on the Plugins > Add New screen is performed using AJAX, no longer performing redirects. This means that users will not see a newly activated plugin's menu items, admin notices, or other UI elements until the user refreshes or navigates to another screen. Without adequate messaging and direction, users may be unsure of what to do next.

This shows an admin notice when a plugin is activated from its plugin card or modal, informing the user that the plugin was activated, and that some changes may not occur until they refresh the page.

Follow-up to [57545].

Props costdev, jorbin, jeherve, flixos90, joedolson, ironprogrammer, audrasjb, alanfuller, kevinwhoffman, devsahadat, afragen, adrianduffell, azaozz, jason_the_adams, JeffPaul, webdevmattcrom, DrewAPicture, justlevine, stevejonesdev, benlk, roytanck.
Fixes #60992. See #22316.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 17:05:07 +00:00
Aaron Jorbin
ee44500e17 REST API: Return empty object when no fallback templates are found (wp/v2/templates/lookup)
This prevents a number of php notices that are surfaced due to the endpoint being called on load of the post editor even when there are no templates.

Props grantmkin, CookiesForDevo, britner, wildworks, jorbin.
Fixes #60909.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57544 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 16:03:14 +00:00
Pascal Birchler
4551e209cd Build/Test Tools: Fix performance tests logging script after [58076].
Removes some unintended debug cruft, whoops!

See #59900.
Built from https://develop.svn.wordpress.org/trunk@58077


git-svn-id: http://core.svn.wordpress.org/trunk@57542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 14:42:16 +00:00
Pascal Birchler
7024b400e9 Build/Test Tools: Overhaul performance tests to improve stability and cover more scenarios.
Simplifies the tests setup by leveraging a test matrix, improving maintenance and making it much easier to test more scenarios. With this change, tests are now also run with an external object cache (Memcached). Additional information such as memory usage and the number of database queries is now collected as well.

Improves test setup and cleanup by disabling external HTTP requests and cron for the tests, as well as deleting expired transients and flushing the cache in-between. This should aid the test stability.

When testing the previous commit / target branch, this now leverages the already built artifact from the build process workflow. Raw test results are now also uploaded as artifacts to aid debugging.

Props swissspidy, adamsilverstein, joemcgill, mukesh27, desrosj, youknowriad, flixos90.
Fixes #59900
Built from https://develop.svn.wordpress.org/trunk@58076


git-svn-id: http://core.svn.wordpress.org/trunk@57541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 13:59:09 +00:00
John Blackbourn
3d9945486e Docs: Various docblock improvements.
See #60699

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


git-svn-id: http://core.svn.wordpress.org/trunk@57540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 13:19:14 +00:00
isabel_brison
6ed4bd3bbe Editor: Merge element style and classname generation to single filter.
Fixes element classnames not being output when block attributes are filtered with `render_block_data`.

Props aaronrobertshaw, isabel_brison, jorbin.
Fixes #60681.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 07:01:15 +00:00
John Blackbourn
9e7d08b60d Docs: Various docblock corrections.
See #60699

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


git-svn-id: http://core.svn.wordpress.org/trunk@57538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-02 00:01:09 +00:00
dmsnell
f56cc47de9 HTML API: Fix context reset in html5lib test suite.
The html5lib-tests suite parses tests from a number of files with a specific
data format. It uses a dataProvider in a loop that yields test information.
This relies on some variables being reset on each iteration. The context
element has not properly reset on each iteration.

The test specification describes the context element as follows:
a9f44960a9/tree-construction/README.md

> Then there *may* be a line that says "#document-fragment", which must be
> followed by a newline (LF), followed by a string of characters that indicates
> the context element, followed by a newline (LF). If the string of characters
> starts with "svg ", the context element is in the SVG namespace and the
> substring after "svg " is the local name. If the string of characters starts
> with "math ", the context element is in the MathML namespace and the
> substring after "math " is the local name. Otherwise, the context element is
> in the HTML namespace and the string is the local name. If this line is
> present the "#data" must be parsed using the HTML fragment parsing algorithm
> with the context element as context.

Without the proper reset of this value, a single context element would change
subsequent tests, breaking the test suite.

This patch adds the reset to ensure that the test suite works properly.

Developed in https://github.com/WordPress/wordpress-develop/pull/6464
Discussed in https://core.trac.wordpress.org/ticket/61102

Fixes #61102.
Props costdev, dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57537 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 23:46:06 +00:00
John Blackbourn
1bbbb4bd75 Docs: Correct some docblock indentation.
See #60699

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


git-svn-id: http://core.svn.wordpress.org/trunk@57536 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 23:44:12 +00:00
Sergey Biryukov
fe416fd2f6 Tests: Use assertSame() in wp_validate_redirect() tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [36444].

Props costdev.
See #60706.
Built from https://develop.svn.wordpress.org/trunk@58070


git-svn-id: http://core.svn.wordpress.org/trunk@57535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 18:56:09 +00:00
Pascal Birchler
d2fb0bd81e General: Remove any usage of wp_reset_vars().
The way `wp_reset_vars()` sets global variables based on `$_POST` and `$_GET` values makes code hard to understand and maintain. It also makes it easy to forget to sanitize input.

This change removes the few places where `wp_reset_vars()` is used in the admin to explicitly use `$_REQUEST` and sanitize any input.

Props swissspidy, audrasjb, davideferre, killua99, weijland, voldemortensen.
Fixes #38073.
Built from https://develop.svn.wordpress.org/trunk@58069


git-svn-id: http://core.svn.wordpress.org/trunk@57534 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 18:01:12 +00:00
Pascal Birchler
5d6024cefb Script Loader: Ensure wp_localize_script() works when called early.
Before, `wp_localize_script()` did not work when the `$wp_scripts` global was not already set (for example because of a script registration happening elsewhere) and even emitted a warning in that case. Due to side effects such as block registration early in the load process, this usually never happened. However, the absence of these side effects in 6.5 caused the `wp_localize_script()` to no longer work in places such as the `login_enqueue_scripts`.

By calling `wp_scripts()` in `wp_localize_script()`, the `$wp_scripts` global is automatically set if needed, restoring previous behavior. Adds both a PHP unit test and an e2e test to verify this use case. Hat tip: jorbin.

Happy birthday, Aaron!

Props salcode, aslamdoctor, jorbin, swissspidy.
Fixes #60862.
Built from https://develop.svn.wordpress.org/trunk@58068


git-svn-id: http://core.svn.wordpress.org/trunk@57533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-05-01 15:42:11 +00:00
Sergey Biryukov
8aa7eb7e16 Coding Standards: Remove extra conditional in get_plugins().
Follow-up to [1894], [5152], [55990].

Props abhijitrakas, mukesh27.
Fixes #44853.
Built from https://develop.svn.wordpress.org/trunk@58067


git-svn-id: http://core.svn.wordpress.org/trunk@57532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 16:45:14 +00:00
Pascal Birchler
c3961d849c REST API: allow overriding excerpt length.
This can be used by the excerpt block in the editor to change the excerpt length without filtering `excerpt_length` in a conflicting way. This enhancement still needs a corresponding change on the Gutenberg side.

Props swissspidy, antonvlasenko, mukesh27, azaozz, andraganescu, timothyblynjacobs.
Fixes #59043.
Built from https://develop.svn.wordpress.org/trunk@58065


git-svn-id: http://core.svn.wordpress.org/trunk@57530 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 09:33:05 +00:00
Pascal Birchler
b2da8bbcc9 I18N: Fix plural usage in wp_print_admin_notice_templates().
Moves the translatable strings from the JS template defined in PHP to the `updates.js` script, where `_n()` can be used as recommended.

Props ideag, SergeyBiryukov, daledupreez, audrasjb, ocean90, swissspidy.
Fixes #37287.
Built from https://develop.svn.wordpress.org/trunk@58064


git-svn-id: http://core.svn.wordpress.org/trunk@57529 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 08:55:04 +00:00
Pascal Birchler
417862e504 Embeds: Remove empty CSS blocks from wp-embed-template.css.
Originally added in [34903], these empty CSS blocks serve no purpose.

Props ravipatel, sabernhardt.
Fixes #61085.
Built from https://develop.svn.wordpress.org/trunk@58063


git-svn-id: http://core.svn.wordpress.org/trunk@57528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 08:44:05 +00:00
Pascal Birchler
7c11d1ebf5 I18N: Actually add all the files for [58061], not just the test fixtures.
Improve support for using only PHP translation files.

This builds on top of the PHP translation file support added in WordPress 6.5, improving the behavior for projects using solely `.l10n.php` translation files and no `.mo.` and `.po` files.

Updates `wp_get_installed_translations()`, which is used when updating language packs and when uninstalling plugins/themes (to remove the translations again), to look for PHP translation files and read metadata from them. Additionally, the file lookup is now cached thanks to using `WP_Textdomain_Registry`.

Updates `Language_Pack_Upgrader::check_package()` to allow language packs that only contain PHP translation files. While WordPress.org continues to serve `.mo` and `.po` files, third-party services might want to only use the PHP file format.

See #60554.
Built from https://develop.svn.wordpress.org/trunk@58062


git-svn-id: http://core.svn.wordpress.org/trunk@57527 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 08:39:07 +00:00
Pascal Birchler
d0b3d1d7ab I18N: Improve support for using only PHP translation files.
This builds on top of the PHP translation file support added in WordPress 6.5, improving the behavior for projects using solely `.l10n.php` translation files and no `.mo.` and `.po` files.

Updates `wp_get_installed_translations()`, which is used when updating language packs and when uninstalling plugins/themes (to remove the translations again), to look for PHP translation files and read metadata from them. Additionally, the file lookup is now cached thanks to using `WP_Textdomain_Registry`.

Updates `Language_Pack_Upgrader::check_package()` to allow language packs that only contain PHP translation files. While WordPress.org continues to serve `.mo` and `.po` files, third-party services might want to only use the PHP file format.

Props swissspidy.
Fixes #60554.
Built from https://develop.svn.wordpress.org/trunk@58061


git-svn-id: http://core.svn.wordpress.org/trunk@57526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 08:36:09 +00:00
audrasjb
3294fc01ba Help/About: Reduce About screens heading sizes on smaller viewports.
[56950] reduced the heading size of About screen headings, but that did not edit the size for smaller viewports.
This changeset fixes this issue, and also updates the larger fluid font size (960px - 1200px).

Follow-up to [56950].

Props dhruvang21, sabernhardt, khokansardar.
Fixes #61030.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57525 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 06:59:09 +00:00
isabel_brison
a3d497718e Editor: add ticket number to test after string update.
Follow-up to [58028]; adds ticket number to the updated test.

Props jorbin, isabel_brison.
See #60981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-30 04:00:06 +00:00
audrasjb
1abb7e0563 Editor: Add item_updated label for wp_template and wp_template_part post types.
This adds the `item_updated` label to Template and Template Part post types registration. This prevents from displaying the default `post updated` label.
See https://github.com/WordPress/gutenberg/pull/61146 

Follow-up to [52062], [51003].

Props ntsekouras, ellatrix.
Fixes #61095.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57520 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-29 22:32:08 +00:00
Sergey Biryukov
9a2a3dc5b3 Tests: Use assertSame() in WP_Comment::get_instance() tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [38381].

Props costdev.
See #60706.
Built from https://develop.svn.wordpress.org/trunk@58054


git-svn-id: http://core.svn.wordpress.org/trunk@57519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-29 15:40:09 +00:00
Tammie Lister
5638ddb0ae Twenty Fourteen: Adds base font size to pullquote block.
The pullquote block needed the base font size adding back in. This also adds in support for appearance settings for weight and style in addition to the original ticket. This fixes a previous commit which changed the default font size of pullquote blocks, quote blocks and blockquotes.

Props sabernhardt.
Fixes #61034.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-29 12:17:10 +00:00
Sergey Biryukov
a93698699b Tests: Use assertSame() in wp_handle_comment_submission() tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [38778], [46829].

Props costdev.
See #60706.
Built from https://develop.svn.wordpress.org/trunk@58052


git-svn-id: http://core.svn.wordpress.org/trunk@57517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-28 18:57:14 +00:00
Sergey Biryukov
93116dbd5c Tests: Add more specific messages for a custom assertion in WP_Test_REST_TestCase.
All assertions in PHPUnit have a `$message` parameter. Setting this parameter allows to distinguish which assertion is failing when a test runs multiple assertions, making debugging of the tests easier.

Follow-up to [34928], [51478], [58039].

See #60426.
Built from https://develop.svn.wordpress.org/trunk@58051


git-svn-id: http://core.svn.wordpress.org/trunk@57516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-26 15:51:15 +00:00
Adam Silverstein
93978139f0 Media: fix potential error in class-avif-info.php::get_item_features().
Import upstream fix from libavifinfo, correcting a potential fatal error.

Props yguyon.
Fixes #60980.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-26 15:02:14 +00:00
dmsnell
4aa1d98bd1 HTML API: Tests should use expectedIncorrectUsage phpunit annotation
Some tests in the HTML API test suite use `setExpectedIncorrectUsage`.
The annotation `@expectedIncorrectUsage` can be used to simplify the tests.

Developed in https://github.com/WordPress/wordpress-develop/pull/6449
Discussed in https://core.trac.wordpress.org/ticket/61080

Fixes #61080.
Props dmsnell, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-26 13:53:15 +00:00
Bernhard Reiter
9c840416cc Tests: Skip Gutenberg plugin activation test on older WP versions.
The purpose of `tests/e2e/specs/gutenberg-plugin.test.js` is to ensure that running the Gutenberg plugin (stable version) on a WordPress `trunk` install doesn't produce any fatals.

The test was introduced in [54913], i.e. it has been around since WP 6.2. It makes sense to have it present on older branches, as the Gutenberg plugin not only supports `trunk`, but also the current stable version of WordPress (i.e. currently 6.5), and one version below (6.4). However, it is not expected to work on any earlier versions beyond that; in practice, it has produced errors on some of those.

This changeset checks the REST API response from the plugin activation request. If it returns an error with error code `plugin_wp_incompatible`, it skips the test.

Props jorbin, johnbillion, swissspidy.
Fixes #60971.
Built from https://develop.svn.wordpress.org/trunk@58046


git-svn-id: http://core.svn.wordpress.org/trunk@57512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-26 10:31:18 +00:00
Sergey Biryukov
2f44f23d92 Docs: Remove extra commas in WP_User_Query::prepare_query() DocBlock.
Follow-up to [52226], [58032].

Props nareshbheda, mukesh27.
Fixes #61076.
Built from https://develop.svn.wordpress.org/trunk@58045


git-svn-id: http://core.svn.wordpress.org/trunk@57511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-25 10:49:16 +00:00
Sergey Biryukov
dfc568cd20 Tests: Use assertSame() in WP_oEmbed_Controller tests.
This ensures that not only the return values match the expected results, but also that their type is the same.

Going forward, stricter type checking by using `assertSame()` should generally be preferred to `assertEquals()` where appropriate, to make the tests more reliable.

Follow-up to [41047].

Props costdev.
See #60706.
Built from https://develop.svn.wordpress.org/trunk@58044


git-svn-id: http://core.svn.wordpress.org/trunk@57510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-24 22:05:18 +00:00
Bernhard Reiter
a3f1555919 Block Hooks: Fix @since and deprecated versions.
Two `@since` PHPDoc fields, and the version argument to one `_deprecated_argument()` incorrectly stated 6.5.1 as the relevant WordPress version where a change was introduced.

This changeset fixes them by setting them to 6.5.3 instead.

Follow-up to [57919].
See #60754.
Built from https://develop.svn.wordpress.org/trunk@58042


git-svn-id: http://core.svn.wordpress.org/trunk@57508 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-24 12:11:15 +00:00
dmsnell
f9776f536f HTML API: Fix detection of single-length funky comments.
Since [60428] the Tag Processor has been misidentifying single-character
funky comments. It has been asserting that the full token-length for a
funky comment must be at least three characters after the opening (e.g.
`</1>`), but it has been starting to look for the closing `>` after
those same three characters. This means that it has been skipping the
actual close of these funky comments and swallowing up the next syntax
until it finds a `>`, often consuming the next tag in the process.

This patch fixes the detector and restores finding the following token.

Developed in https://github.com/WordPress/wordpress-develop/pull/6412
Discussed in https://core.trac.wordpress.org/ticket/60170

Follow-up to [60428].
Fixes #60170.
Props dmsnell, gziolo, jonsurrell.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57506 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-24 07:45:14 +00:00
Sergey Biryukov
9d5f8481df Tests: Add a $message parameter for a custom assertion in WP_Test_REST_TestCase.
All assertions in PHPUnit have a `$message` parameter. Setting this parameter allows to distinguish which assertion is failing when a test runs multiple assertions, making debugging of the tests easier.

This optional parameter is now added for `WP_Test_REST_TestCase::assertErrorResponse()`.

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

Props mykolashlyakhtun, antonvlasenko, swissspidy, SergeyBiryukov.
Fixes #60426.
Built from https://develop.svn.wordpress.org/trunk@58039


git-svn-id: http://core.svn.wordpress.org/trunk@57505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-23 18:57:12 +00:00
Pascal Birchler
4d09a87655 Docs: Improve incorrect indentation/alignment in a few docblocks.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@58037


git-svn-id: http://core.svn.wordpress.org/trunk@57503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-23 12:38:14 +00:00
audrasjb
258523f63e Toolbar: Replace "Edit Site" link with "Site Editor" in the Admin Toolbar.
This changesets replaces the "Edit Site" link with "Site Editor" to avoid duplicate link anchors on multisite admin toolbar. The remaining "Edit site" link takes the user to the site editing screen in the network admin area (`network/site-info.php`) while the new "Site Editor" link takes the user to the site editor (`site-editor.php`).

Follow-up to [52158]. See GB27135.

Props johnbillion, sabernhardt, audrasjb, johnjamesjacoby, pratiklondhe.
Fixes #60977.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57501 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 21:06:08 +00:00
Tammie Lister
0eb5aed212 Twenty Twenty-Three: Wraps navigation block in row within header template part.
This allows inserting of own blocks into header since the release of the Block Hooks API, specifically after the navigation block.

Props tomjcafferkey, poena, shailu25.
Fixes #60723.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 20:55:09 +00:00
audrasjb
6371434821 Media: Prevent division by zero in wp_img_tag_add_width_and_height_attr().
This changesets adds a check for `$size_array` values to prevent a potential division by zero.
Follow-up to [57294].

Props jdekhtiar.
Fixes #61054.
See #59352.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57499 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 20:35:10 +00:00
audrasjb
2d2b97f115 Docs: Typo corrections in class WP_Meta_Query.
Props truptikanzariya.
Fixes #61051.
See #60699.



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


git-svn-id: http://core.svn.wordpress.org/trunk@57498 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 20:25:08 +00:00
Tammie Lister
95533c6f68 Twenty Twelve: Fixes typing errors in block pattern.
There were several instances of typo corrections in block patterns. This removes the last sentence for a simpler resolution.

Props sabernhardt.
Fixes #61004.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 20:19:15 +00:00
isabel_brison
9fd435aa15 Editor: fix spacing in function doc.
Correctly formats spacing in `get_layout_styles` docblock.

Props mukesh27, sabernhardt.
See #60981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 07:20:09 +00:00
Sergey Biryukov
4fb8608aa5 Docs: Use correct URL for the Embeds documentation article.
Follow-up to [57793].

Props shailu25, estelaris, audrasjb.
See #60732.
Built from https://develop.svn.wordpress.org/trunk@58029


git-svn-id: http://core.svn.wordpress.org/trunk@57495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 06:25:11 +00:00
isabel_brison
9ecc777ded Editor: limit layout rules on themes without theme.json.
Removes output of base rules for flow and constrained layout types on themes without theme.json.

Props evanltd, poena, isabel_brison, andrewserong, oandregal.
See #60981.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57494 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-22 05:30:13 +00:00
Sergey Biryukov
46356f0215 Docs: Remove extra space before @since in WP_Block_Bindings_Registry DocBlock.
Follow-up to [57373].

Props shailu25.
Fixes #61046.
Built from https://develop.svn.wordpress.org/trunk@58027


git-svn-id: http://core.svn.wordpress.org/trunk@57493 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-21 03:52:11 +00:00
Sergey Biryukov
453c78db60 Coding Standards: Use strict comparison in wp_add_global_styles_for_blocks().
Follow-up to [57546].

Props immeet94.
Fixes #60964.
Built from https://develop.svn.wordpress.org/trunk@58026


git-svn-id: http://core.svn.wordpress.org/trunk@57492 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-20 04:01:18 +00:00
Joe McGill
244a8cf308 Themes: Cache block theme patterns in a transient.
This extends the benefits of persistent caching added in [56978] for block theme patterns to sites that are not using a persistent object cache. By default, these caches expire using the value of the `WP_Theme::cache_expiration` property. The transient cache TTL can be overridden using the newly introduced `wp_theme_files_cache_ttl` filter.

Props thekt12, joemcgill, flixos90, peterwilsoncc, spacedmonkey.
See #59600, #59719.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-19 17:59:16 +00:00
Sergey Biryukov
670692386b Docs: Fix typo in WP_Block_Type::__construct() DocBlock.
Follow-up to [54155].

Props ixkaito.
Fixes #61035.
Built from https://develop.svn.wordpress.org/trunk@58024


git-svn-id: http://core.svn.wordpress.org/trunk@57490 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-19 03:42:18 +00:00
Sergey Biryukov
3c5da9c743 Login and Registration: Check that redirect_to is a string in wp-login.php.
This prevents a fatal error if an array is passed instead.

Follow-up to [2876], [4969], [7524], [8701], [25701], [31417], [49109].

Props TimoTijhof.
Fixes #59373.
Built from https://develop.svn.wordpress.org/trunk@58023


git-svn-id: http://core.svn.wordpress.org/trunk@57489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-18 06:24:22 +00:00
Peter Wilson
f6fae87e73 Upgrade/Install: Validate source & destination values in WP_Ugrader.
Adds a missing string and some additional validation of paths in the upgrader class.

Follow up to [56992].

Props costdev, jipmoors, karlijnbok, swissspidy, afragen, mukesh27.
Fixes #59712.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57488 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-18 03:17:13 +00:00
joedolson
cc7370b2af Help/About: Accessibility: Remove target="_blank" from data eraser links.
Remove `target="_blank"` from two links to developer resources on adding the personal data eraser to plugins in the Help info for the privacy screens. Also rectifies differences between the export and erase text for consistency and changes the order of paragraphs. 

Props sabernhardt, joedolson.
Fixes #60097.
Built from https://develop.svn.wordpress.org/trunk@58021


git-svn-id: http://core.svn.wordpress.org/trunk@57487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-17 20:21:15 +00:00
Sergey Biryukov
1c0e271c2f Docs: Correct @since version for COOKIE_DOMAIN default value change.
Follow-up to [58011].

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


git-svn-id: http://core.svn.wordpress.org/trunk@57483 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-17 09:46:19 +00:00
Sergey Biryukov
dc9dbf913f Users: Set the default value of COOKIE_DOMAIN to an empty string.
This matches the type expected by the `setcookie()` function for the `$domain` parameter, and resolves a fatal error if `strict_types` is enabled.

Reference: [https://www.php.net/setcookie PHP Manual: setcookie()].

Follow-up to [2725], [6434], [12732], [13062].

Props kmvan, rajinsharwar, jrf, desrosj, Cybr, nicolefurlan, oglekler, hellofromTonya, kirasong, chaion07, mukesh27.
Fixes #46550.
Built from https://develop.svn.wordpress.org/trunk@58011


git-svn-id: http://core.svn.wordpress.org/trunk@57482 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-16 16:52:14 +00:00
dmsnell
d2ce038894 HTML API: Validate HTML Processor against external test suite from html5lib.
In this patch, the test suite from html5lib validates the tree-construction
steps in the HTML Processor to ensure that they are behaving according to the
HTML specification. This suite of tests is also used by the servo project to
test its html5ever package.

A new test module in the HTML API transforms HTML Processor output to match
the expected tree shape from the external tests. For cases where there are
tests validating behaviors of unsupported HTML tags and constructs, the tests
are marked as skipped. As the HTML API continues to expand its own support,
the number of skipped tests will automatically shrink down towards zero.

Additional tests are skipped through the `SKIP_TEST` array in the test runner.

Fixes #60227.
See #58517.
Props azaozz, costdev, dmsnell, hellofromtonya, jonsurrell, jorbin, swisspidy.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-16 12:08:17 +00:00
Sergey Biryukov
dd6d4e74c1 Code Modernization: Fix implicit nullable parameter type deprecation on PHP 8.4.
In PHP 8.4, declaring function or method parameters with a default value of `null` is deprecated if the type is not nullable.

PHP applications are recommended to ''explicitly'' declare the type as nullable. All type declarations that have a default value of `null`, but without declaring `null` in the type declaration, will emit a deprecation notice:
{{{
function test( array $value = null ) {}
}}}
`Deprecated: Implicitly marking parameter $value as nullable is deprecated, the explicit nullable type must be used instead`

**Recommended Changes**

Change the implicit nullable type declaration to a nullable type declaration, available since PHP 7.1:
{{{#!diff
- function test( string $test = null ) {}
+ function test( ?string $test = null ) {}
}}}

This commit updates the affected instances in core to use a nullable type declaration.

References:
* [https://wiki.php.net/rfc/deprecate-implicitly-nullable-types PHP RFC: Deprecate implicitly nullable parameter types]
* [https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated PHP.Watch: PHP 8.4: Implicitly nullable parameter declarations deprecated]

Follow-up to [28731], [50552], [57337], [57985].

Props ayeshrajans, jrf, audrasjb, jorbin.
Fixes #60786.
Built from https://develop.svn.wordpress.org/trunk@58009


git-svn-id: http://core.svn.wordpress.org/trunk@57480 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-15 20:03:09 +00:00
Tammie Lister
593ccf4342 Twenty Eleven: Removes Negative values for padding.
This fixes the issue where negative values aren't allows in older versions of IE. There is more discussion in another ticket on a wider approach, but for now the decision to commit this was made as an interim solution.

Props mukesh27, SergeyBiryukov, sabernhardt, poena.
Fixes #46771.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57479 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-15 16:40:12 +00:00
Tammie Lister
44528d4fba Twenty Twenty Two: Wraps Navigation block in row.
Now that the Blocks Hooks API is released in 6.4, you might want to insert blocks into header of the theme after the Navigation block. This wraps to allow this.

Props tomjcafferkey, poena, shailu25.
Fixes #60724.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-15 16:26:15 +00:00
Sergey Biryukov
8689afae77 Twenty Twenty-One: Check for WP_Error before outputting get_the_tag_list().
This prevents a fatal error on PHP 8 and brings consistency with the other bundled themes.

Follow-up to [47886].

Props josephscott, sabernhardt, poena, nirav7707, devsahadat.
Fixes #60800.
Built from https://develop.svn.wordpress.org/trunk@57991


git-svn-id: http://core.svn.wordpress.org/trunk@57477 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-14 21:57:13 +00:00
Sergey Biryukov
7bb686d18b Users: Account for returning false from the authenticate filter.
While technically only `null`, `WP_User`, or `WP_Error` should be returned from the `authenticate` filter, a plugin might return boolean `false` instead, which would trigger the `authentication_failed` error prior to [57882].

This commit aims to preserve that behavior in case `false` is returned.

Follow-up to [57882].

Props johnbillion.
See #60700.
Built from https://develop.svn.wordpress.org/trunk@57990


git-svn-id: http://core.svn.wordpress.org/trunk@57476 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-13 16:33:13 +00:00
Tammie Lister
8d0570f72c Twenty Fourteen: Fixes pullquote block issues with font sizing.
The pullquote block was not showing increase in sizes within the editor. This solves that and allows you to see the change both in the editor and front.

Props nidhidhandhukiya, huzaifaalmesbah.
Fixes #59800.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57475 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 19:55:12 +00:00
Pascal Birchler
09be520d72 Docs: Revert unintended svn:ignore change after [57987].
See #60699.
Built from https://develop.svn.wordpress.org/trunk@57988


git-svn-id: http://core.svn.wordpress.org/trunk@57474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 17:50:12 +00:00
Pascal Birchler
00d06db33d Docs: Fix various typos and spelling mistakes.
Props swissspidy, jucaduca, sergeybiryukov.
See #60699.
Built from https://develop.svn.wordpress.org/trunk@57987


git-svn-id: http://core.svn.wordpress.org/trunk@57473 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 17:47:13 +00:00
Sergey Biryukov
98d90f8533 Coding Standards: Upgrade WPCS to version 3.1.0.
The impact on existing WordPress core code is expected to be minimal, but the release does provide more safeguards for the future.

References:
* [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.1.0 WPCS 3.1.0 release notes]
* [https://github.com/WordPress/WordPress-Coding-Standards/compare/3.0.1...3.1.0 Full list of changes in WPCS 3.1.0]

Follow-up to [56695], [56799], [57378].

Props jrf, garyj, dingo_d, rodrigosprimo, Chouby, westonruter, bjorsch.
Fixes #60840.
Built from https://develop.svn.wordpress.org/trunk@57986


git-svn-id: http://core.svn.wordpress.org/trunk@57472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-12 12:17:10 +00:00
John Blackbourn
dd224888c7 General: Increase the minimum supported version of PHP to 7.2.24.
Props justlevine, masteradhoc, samiamnot, hellofromTonya, azaozz, jrf, dd32, desrosj, jorbin

Fixes #58719

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


git-svn-id: http://core.svn.wordpress.org/trunk@57471 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-11 21:11:16 +00:00
Sergey Biryukov
181e799593 Docs: Update @since version for wp_zip_file_is_valid().
Follow-up to [57537], [57916], [57929].

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


git-svn-id: http://core.svn.wordpress.org/trunk@57470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-11 14:28:14 +00:00
Pascal Birchler
a6b9c3d542 Script Loader: stop enqueueing some now obsolete polyfills.
Stop enqueueing polyfills such as `wp-polyfill-inert` (for the `inert` attribute) and `regenerator-runtime` (for generator functions), as they are no longer needed, considering the WordPress project's [https://make.wordpress.org/core/handbook/best-practices/browser-support/ browser support policy].

In addition to that, `wp-polyfill` (essentially `core-js`) is no longer enqueued as a dependency of `react`. This was added in [43903] to ensure compatibility with IE 11, which is no longer supported by WordPress. Developers requiring `wp-polyfill` need to manually add it as a dependency for their scripts.

Props swissspidy, flixos90, adamsilverstein, youknowriad, gziolo.
Fixes #60962.
Built from https://develop.svn.wordpress.org/trunk@57981


git-svn-id: http://core.svn.wordpress.org/trunk@57467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-10 14:42:17 +00:00
John Blackbourn
a04dc48ea7 Editor: Update npm packages.
Updates the editor npm packages to the latest patch versions for 6.5.1.

See https://github.com/WordPress/gutenberg/pull/60577.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-09 10:57:27 +00:00
isabel_brison
8fbd2fc6f4 Editor: skip outputting base layout rules if content and wide size values don’t exist.
Skip outputting layout rules that reference content and wide sizes CSS variables, if no layout sizes exist in the current `theme.json`.

Props andrewserong.
Fixes #60936.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-09 07:20:15 +00:00
jorgefilipecosta
f3873d2f8a Coding Standards: Fix missing strict in_array on block-template-utils.php.
Props swissspidy.
Built from https://develop.svn.wordpress.org/trunk@57946


git-svn-id: http://core.svn.wordpress.org/trunk@57443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-08 21:42:17 +00:00
Sergey Biryukov
440a5f21ca Twenty Twenty-Four: Remove pattern from home template to improve performance.
Creating the Home Business pattern was needed to show it on the template replacement flows, but there's no need to use it in the template, and the minor code repetition is better than having to do a an extra pattern replacement.

Follow-up to [https://github.com/WordPress/twentytwentyfour/pull/486 PR #486].

Props onemaggie, youknowriad, poena, afercia.
Fixes #60620.
Built from https://develop.svn.wordpress.org/trunk@57945


git-svn-id: http://core.svn.wordpress.org/trunk@57442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-08 19:21:16 +00:00
jorgefilipecosta
a0712d7758 Honor template_hierarchy filters when creating a template in the Site Editor.
Currently, in blocks themes it's possible to use the ${type}_template_hierarchy filter to alter the template hierarchy. However, those filters are not taken into consideration by the Choose a pattern popup screen that appears when creating a new template in the Site Editor, causing a mismatch between the editor and the frontend.

Props aljullu, mukesh27, ntsekouras, jorgefilipecosta, gziolo.
Fixes #60846.
Built from https://develop.svn.wordpress.org/trunk@57944


git-svn-id: http://core.svn.wordpress.org/trunk@57441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-08 16:47:16 +00:00
Peter Wilson
f4fb98f366 Script Loader: Improve asset concatenation Etags.
Include the asset version of JavaScript and CSS files when generating the ETag for concatenated assets in `load-scripts.php` and `load-styles.php`. This ensures the ETag is updated as script versions change (for example editor package updates) rather than only when the WordPress version changes.

The `W\` prefix is added to the generated ETag to allow for CDNs and proxy servers modifying the script to add or improve the compression algorithm.

Props azaozz, dav4, ironprogrammer, johnbillion, kkmuffme, monzuralam, peterwilsoncc, sergeybiryukov.
Fixes #58433.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-07 23:53:19 +00:00
Sergey Biryukov
c518c3a924 Docs: Correct @since version for status code 425 in get_status_header_desc().
Follow-up to [57936].

See #60942.
Built from https://develop.svn.wordpress.org/trunk@57937


git-svn-id: http://core.svn.wordpress.org/trunk@57438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-07 11:22:08 +00:00
Sergey Biryukov
70e045910b HTTP API: Add support for a description for HTTP status code 425 (Too Early).
Reference: [https://datatracker.ietf.org/doc/rfc8470/ RFC 8470: Using Early Data in HTTP].

Follow-up to [5446], [6104], [10740], [27422], [36274], [36294], [42207].

Props kkmuffme, mukesh27, joemcgill.
Fixes #60942.
Built from https://develop.svn.wordpress.org/trunk@57936


git-svn-id: http://core.svn.wordpress.org/trunk@57437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-07 11:18:17 +00:00
Sergey Biryukov
46676b4060 Coding Standards: Use strict comparison in wp-includes/class-wp-image-editor-imagick.php.
Follow-up to [22094].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.
Built from https://develop.svn.wordpress.org/trunk@57934


git-svn-id: http://core.svn.wordpress.org/trunk@57435 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-06 13:37:18 +00:00
Aaron Jorbin
a7f59e981f Media: Use flex-start for full browser support.
The value of `start` is not fully supported by Opera Mini which has 1.01% usage. There is no material change in functionality with this change.

Follow-up to [55919].

Props davidbaumwald, sabernhardt, khokansardar, devsahadat.
Fixes #60876.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-05 21:47:15 +00:00
Tammie Lister
103d0deb89 Twenty Twenty-Four: Fixes typo in testimonial pattern.
There was a small typo which was in a string context only visible to translators for the testimonial pattern. This fixes that.

Props shailu25, SergeyBiryukov.
Fixes #60924.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-05 20:46:15 +00:00
Sergey Biryukov
6bc444cc42 Tests: Use an image on WordPress.org CDN in external HTTP tests.
Due to some changes on the WP.com side to compress the requested images on the fly, the exact image size in the response could be different between platforms.

This commit aims to make the affected tests more reliable.

Follow-up to [139/tests], [31258], [34568], [47142], [57903], [57904], [57924].

Props peterwilsoncc, jorbin.
See #60865.
Built from https://develop.svn.wordpress.org/trunk@57931


git-svn-id: http://core.svn.wordpress.org/trunk@57432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-05 12:12:14 +00:00
Joe McGill
9bb63fd665 Themes: Avoid errors in some environments from _get_block_templates_paths.
This adds an `is_dir()` check in `_get_block_templates_paths` before trying to run a `RecursiveDirectoryIterator` to avoid errors being reported in New Relic even thought the errors should be handled by a try/catch block.

Follow-up to [57215].

Props iCaleb, sean212, mukesh27, joemcgill.
Fixes #60915.


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


git-svn-id: http://core.svn.wordpress.org/trunk@57429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 18:56:57 +00:00
John Blackbourn
78d729602e Database: Remove back-compat for database servers that don't support utf8mb4.
Since WordPress 6.5, the minimum supported version of MySQL and MariaDB is 5.5.5. This means all supported database servers now support the `utf8mb4` character set and therefore the conditional logic for this is no longer necessary.

Props l1nuxjedi, craigfrancis, OllieJones, johnbillion

Fixes #60096

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


git-svn-id: http://core.svn.wordpress.org/trunk@57427 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 15:13:14 +00:00
Pascal Birchler
1c8b25a7a5 I18N: Bail early if an invalid text domain is passed to load_textdomain() et al.
Some plugins pass invalid values such as `null` instead of a string, which has never been supported by WordPress (no translations are loaded) and was technically undefined behavior. With the introduction of the new l10n library in #59656, which has stricter type hints, this could end up causing warnings or even fatal errors.

This change adds a deliberate short-circuit to `load_textdomain()` & co. to better handle such a case and document that it is not supported.

Props verygoode, swissspidy.
Fixes #60888.
Built from https://develop.svn.wordpress.org/trunk@57925


git-svn-id: http://core.svn.wordpress.org/trunk@57426 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 13:56:13 +00:00
Pascal Birchler
f09686a12a Build/Test Tools: Update a few image URLs in HTTP and image cropping tests.
Follow-up to #60865 / [57903] where similar instances were recently updated due to an upstream change.

Particularly the `test_wp_crop_image_with_url()` test recently began to fail on some environments, likely because of the same change.

This updates the image URLs with the aim to bring more consistency and to get the test passing again more broadly.

Fixes #60907.
Built from https://develop.svn.wordpress.org/trunk@57924


git-svn-id: http://core.svn.wordpress.org/trunk@57425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 13:45:10 +00:00
Pascal Birchler
3ed6382329 Permalinks: Detect FrankenPHP web server support.
Support pretty permalinks when FrankenPHP server is detected, which is built on top of Caddy. Caddy detection was added in [57612].

Props swissspidy, stephenmiracle.
Fixes #60884.
Built from https://develop.svn.wordpress.org/trunk@57923


git-svn-id: http://core.svn.wordpress.org/trunk@57424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 13:40:06 +00:00
Pascal Birchler
54a61e9c9b I18N: Always search for script translations in wp-content/languages/plugins.
Previously, when `WP_PLUGIN_DIR` was set to something other than `wp-content/plugins`, e.g. `wp-content/mods`, `load_script_textdomain` was searching for script translations in `wp-content/languages/mods`. However, that is incorrect, as `WP_PLUGIN_DIR` does not affect where translations are stored. The location is always `wp-content/languages/plugins`.

Props coreymckrill, swissspidy.
Fixes #60891.
Built from https://develop.svn.wordpress.org/trunk@57922


git-svn-id: http://core.svn.wordpress.org/trunk@57423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 13:38:11 +00:00
Sergey Biryukov
9ac3e01c91 Docs: Fix typo in wp_mediaelement_fallback filter description.
Follow-up to [23729], [28128].

Props dilipbheda, mukesh27.
Fixes #60917.
Built from https://develop.svn.wordpress.org/trunk@57921


git-svn-id: http://core.svn.wordpress.org/trunk@57422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-04 11:19:14 +00:00
Felix Arntz
6fe9681e77 Options, Meta APIs: Use more sensible default for autoloading options which allows WordPress core to make a decision.
An excessive amount of autoloaded options is a common cause for slow database responses, sometimes caused by very large individual autoloaded options. As it is not mandatory to provide an autoload value when adding an option to the database, it tends to be ignored, which in combination with a default value of "yes" and lack of documentation can lead to the aforementioned problem.

This changeset enhances the option autoloading behavior in several ways:
* Update the function documentation to encourage the use of boolean `true` or `false` to explicitly provide an autoload value for an option.
* Use new string values `on` and `off` for explicitly provided values stored in the database, to distinguish them from `yes` and `no`, since `yes` does not allow determining whether it was set intentionally by the developer or only as a default.
* Effectively deprecate the values `yes` and `no`. They are still supported for backward compatibility, but now discouraged.
* Use `null` as new default autoload value for `add_option()`. If the developer does not provide an explicit value, this will now trigger WordPress logic to determine an autoload value to use:
    * If WordPress determines that the option should not be autoloaded, it is stored in the database as `auto-off`. As part of this changeset, the single heuristic introduced for that is to check whether the option size is larger than a threshold of 150k bytes. This threshold is filterable via a new `wp_max_autoloaded_option_size` filter.
    * If WordPress determines that the option should be autoloaded, it is stored in the database as `auto-on`. No logic to make such a decision is introduced as part of this changeset, but a new filter `wp_default_autoload_value` can be used to define such heuristics, e.g. by optimization plugins.
    * If WordPress cannot determine whether or not to autoload the option, it is stored in the database as `auto`.
    * This effectively means that any option without an explicit autoload value provided by the developer will be stored with an autoload value of `auto`, unless the option's size exceeds the aforementioned threshold. Options with a value of `auto` are still autoloaded as of today, most importantly for backward compatibility. A new function `wp_autoload_values_to_autoload()` returns the list of autolaod values that dictate for an option to be autoloaded, and a new filter `wp_autoload_values_to_autoload` can be used to alter that list.

These behavioral changes encourage developers to be more mindful of autoloading, while providing WordPress core and optimization plugins with additional control over heuristics for autoloading options where no explicit autoload value was provided.

At the same time, the changes are fully backward compatible from a functionality perspective, with the only exception being that very large options will now no longer be autoloaded if the developer did not explicitly request for them to be autoloaded. Neither WordPress core nor plugins are able to override an explicitly provided value, which is intentional to continue giving developers full control over their own options.

Props pbearne, flixos90, joemcgill, azaozz, spacedmonkey, swissspidy, mukesh27, markjaquith.
Fixes #42441.

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


git-svn-id: http://core.svn.wordpress.org/trunk@57421 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-03 21:31:15 +00:00
Bernhard Reiter
725f302121 Block Hooks: Pass correct context to filters.
The `$context` argument passed to filters such as `hooked_block_types`, `hooked_block`, and `hooked_block_{$hooked_block_type}` allows them to conditionally insert a hooked block. If the anchor block is contained in a template or template part, `$context` will be set to a `WP_Block_Template` object reflecting that template or part.

The aforementioned filters are applied when hooked block insertion is run upon reading a template (or part) from the DB (and before sending the template/part content with hooked blocks inserted over the REST API to the client), but also upon writing to the DB, as that's when the `ignoredHookedBlocks` metadata attribute is set.

Prior to this changeset, the `$context` passed to Block Hooks related filters in the latter case reflected the template/part that was already stored in the database (if any), which is a bug; instead, it needs to reflect the template/part that will result from the incoming `POST` network request that will trigger a database update.

Those incoming changes are encapsulated in the `$changes` argument passed to the `reset_pre_insert_template` and  `reset_pre_insert_template_part` filters, respectively, and thus to the `inject_ignored_hooked_blocks_metadata_attributes` function that is hooked to them. `$changes` is of type `stdClass` and only contains the fields that need to be updated. That means that in order to create a `WP_Block_Template` object, a two-step process is needed:

- Emulate what the updated `wp_template` or `wp_template_part` post object in the database will look like by merging `$changes` on top of the existing `$post` object fetched from the DB, or from the theme's block template (part) file, if any.
- Create a `WP_Block_Template` from the resulting object.

To achieve the latter, a new helper method (`_build_block_template_object_from_post_object`) is extracted from the existing `_build_block_template_result_from_post` function. (The latter cannot be used directly as it includes a few database calls that will fail if no post object for the template has existed yet in the database.)

While somewhat complicated to implement, the overall change allows for better separation of concerns and isolation of entities. This is visible e.g. in the fact that `inject_ignored_hooked_blocks_metadata_attributes` no longer requires a `$request` argument, which is reflected by unit tests no longer needing to create a `$request` object to pass to it, thus decoupling the function from the templates endpoint controller.

Unit tests for `inject_ignored_hooked_blocks_metadata_attributes` have been moved to a new, separate file. Test coverage has been added such that now, all three relevant scenarios are covered:

- The template doesn't exist in the DB, nor is there a block theme template file for it.
- The template doesn't exist in the DB, but there is a block theme template file for it.
- The template already exists in the DB.

Those scenarios also correspond to the logical branching inside `WP_REST_Templates_Controller::prepare_item_for_database`, which is where `inject_ignored_hooked_blocks_metadata_attributes` gets its data from.

Props tomjcafferkey, bernhard-reiter, gziolo, swissspidy.
Fixes #60754.
Built from https://develop.svn.wordpress.org/trunk@57919


git-svn-id: http://core.svn.wordpress.org/trunk@57420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-03 15:11:14 +00:00
Pascal Birchler
d6ce792045 Build/Test Tools: Migrate to Docker Compose V2.
Compose V2, which was first released in 2020, is included with all currently supported versions of Docker Desktop. Compose V1 stopped receiving updates in July 2023.

The biggest difference is that the command to interact with Compose changed from `docker-compose` to `docker compose`.

GitHub has now started removing V1 from Ubuntu & Windows images, which caused all Docker-based GitHub Actions workflows to fail.

This change migrates to the new `docker compose` command to address these failures.

Props swissspidy, thelovekesh.
Fixes #60901.
Built from https://develop.svn.wordpress.org/trunk@57918


git-svn-id: http://core.svn.wordpress.org/trunk@57419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-03 11:33:12 +00:00
Sergey Biryukov
c98b4ce7f3 Coding Standards: Use strict comparison in wp-includes/class-wp-image-editor-gd.php.
Follow-up to [22094], [22817], [50810], [57524].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.
Built from https://develop.svn.wordpress.org/trunk@57917


git-svn-id: http://core.svn.wordpress.org/trunk@57418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-03 10:33:24 +00:00
Sergey Biryukov
db1e75b20a Docs: Update @since version for wp_zip_file_is_valid().
Follow-up to [57537].

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


git-svn-id: http://core.svn.wordpress.org/trunk@57417 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-02 19:24:16 +00:00
desrosj
657f36adfa Build/Test Tools: Include 6.4 and 6.5 in upgrade testing.
This ensures that upgrading from 6.4 and 6.5 to the desired version is actually tested.

See #60733.
Built from https://develop.svn.wordpress.org/trunk@57915


git-svn-id: http://core.svn.wordpress.org/trunk@57416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-04-02 19:19:17 +00:00