Commit Graph

22390 Commits

Author SHA1 Message Date
Sergey Biryukov
fe3efe9810 HTML API: Scan to end of tag when getting updated HTML output.
When applying updates to HTML, one step was left out in [56941] which updated the position of the end of the current tag. This made it possible to create bookmarks with null or earlier end positions than their start position. This in turn broke the Directive Processor in Gutenberg during the backport of changes from Core into Gutenberg.

In this commit, after applying updates, the HTML document is now scanned fully to the end of the current tag, updating the internal pointer to its end, so that nothing else will be broken or misaligned.

Follow-up to [56941].

Props dmsnell.
Fixes #59643.
Built from https://develop.svn.wordpress.org/trunk@56953


git-svn-id: http://core.svn.wordpress.org/trunk@56464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 10:39:27 +00:00
Sergey Biryukov
41a5f69fde Twenty Nineteen: Correct the required WordPress version in theme headers.
The required version was previously set to two different values:
* 4.7 in the theme's `functions.php` file.
* 4.9.6 in theme headers, because of the `the_privacy_policy_link()` function usage in `footer.php`.

However, as `the_privacy_policy_link()` call is wrapped in a `function_exists()` check, it does not affect the requirements in practice.

This commit aims to correct the discrepancy by updating theme headers to match the actual required WP version.

Follow-up to [43808], [43892].

Props poena, kafleg, felipeelia, audrasjb, huzaifaalmesbah, shailu25, nicolefurlan, oglekler.
Fixes #59557.
Built from https://develop.svn.wordpress.org/trunk@56952


git-svn-id: http://core.svn.wordpress.org/trunk@56463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 09:54:23 +00:00
hellofromTonya
244f676c59 Twenty Twenty-Four: Bugfixes for 6.4 RC1.
Resyncing changes for TT4 into Core.

Changes include:
* Reformatted all the patterns for readability.
* Bugfixes in the markup and improvements on the string translation functions.
* Renaming of some patterns, making them consistent with the content they show and whether they are simple patterns, full-page patterns or patterns meant to replace templates.

Follow-up to [56813], [56764], [56716].

Props richtabor, onemaggie, luminuu, shailu25, dunhakdis, shivashankerbhatta, dajeema, enodekciw, kafleg, viralsampat, glendaviesnz, beafialho, webmandesign, huzaifaalmesbah, gregfuller, benharri.
Fixes #59640.
Built from https://develop.svn.wordpress.org/trunk@56951


git-svn-id: http://core.svn.wordpress.org/trunk@56462 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 02:14:24 +00:00
Aaron Jorbin
223c80ef92 Help/About: Update the About page for 6.4.
Also includes updates to the contribute, credits, freedom and privacy pages.

Props luminuu, rmartinezduque, estelaris, jorbin, mukesh27, cbringmann, richtabor, annezazu, nudge, ohia, acirujano, elmastudio, cathibosco1, sereedmedia, markoserb, joen. (Also someone named Allison who I am going to guess is Taylor Alison Swift but has no avatar so I will never know)

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


git-svn-id: http://core.svn.wordpress.org/trunk@56461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-17 02:02:24 +00:00
Peter Wilson
6876d19129 Options, Meta APIs: Prevent saving of invalid timezones.
Prevent the saving of invalid timezone string in to the database on the options pages. If an invalid timezone is submitted it is ignored and the setting remains unchanged.

This prevents a warning or fatal (depending on the PHP version) from being thrown by an invalid timezone setting on the Settings > General page.

Props ankit-k-gupta, costdev, huzaifaalmesbah, mrinal013, nicolefurlan, oglekler.
Fixes #58814.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 23:51:24 +00:00
Aaron Jorbin
86be091aba CSS: Run grunt precommit:css to update CSS.
See: #58869.
Props peterwilsoncc.



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


git-svn-id: http://core.svn.wordpress.org/trunk@56459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 21:48:24 +00:00
Joe McGill
807517a992 Options, Meta APIs: Delete leftover unit tests.
This is a followup to [56946] to commit the deletion of a leftover PHP Unit file.

See #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 20:41:19 +00:00
Joe McGill
9a810ff5bc Options, Meta APIs: Revert update_option changes.
This reverts changes from [56648], [56681], [56717], [56762], [56788], [56797], and [56814] to restore the behavior for `update_option()` and `update_network_option()` to their prior state as of 6.3.X due to the discovery of various backwards compatibility issues found late in the 6.4 release cycle.

Props mukesh27, costdev, flixos90, spacedmonkey, snicco, jrf, joemcgill.
See #22192, #59360.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 20:37:23 +00:00
Tammie Lister
8325d334f6 Update editor related npm packages for 6.4 RC1.
The npm packages needed a second part to the update for 6.4 RC1.

Props isabel_brison, andrewserong, jsnajdr, wildworks, joen, mciampini, tyxla, youknowriad, ramonopoly, spacedmonkey, dmsnell, mikachan, kishanjasani, czapla, siobhyb, darerodz, luisherranz

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56456 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 19:17:19 +00:00
desrosj
aa29f65a28 Build/Test Tools: Downgrade grunt-contrib-qunit dependency.
`grunt-contrib-qunit` was upgraded from version `7.0.1` to `8.0.1` in [56647]. However, this update causes a strange failure when running the build script for the Gutenberg plugin when checked out within a `wordpress-develop` checkout.

This reverts the related change in [56647] and downgrades the dependency back to `7.0.1` until the exact reason for the failure is narrowed down.

Props afercia, kevin940726, antonvlasenko, desrosj.
See #59634, #58863.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56455 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 16:05:27 +00:00
Felix Arntz
41cf4f1521 General: Remove discouraged @return void annotations.
Such `@return void` annotations must not be used in WordPress core's PHP code, except bundled themes, third-party libraries, and PHP compatibility shims.

Props isabel_brison, swissspidy.
Fixes #59619.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 15:17:23 +00:00
Pascal Birchler
a69a0dfcb0 Build/Test Tools: Ensure the failed workflow tasks run last for e2e tests.
This is a follow-up to [56926], where this logic has been reintroduced after it was originally removed in [56198].

Props desrosj.
See #59517.
Built from https://develop.svn.wordpress.org/trunk@56942


git-svn-id: http://core.svn.wordpress.org/trunk@56453 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 14:34:21 +00:00
Sergey Biryukov
89a5bbb997 HTML API: Avoid calling subclass method while internally scanning in Tag Processor.
After modifying tags in the HTML API, the Tag Processor backs up to before the tag being modified and then re-parses its attributes. This saves on the code complexity involved in applying updates, which have already been transformed to “lexical updates” by the time they are applied.

In order to do that, `::get_updated_html()` called `::next_tag()` to reuse its logic. However, as a public method, subclasses may change the behavior of that method, and the HTML Processor does just this. It maintains an HTML stack of open elements and when the Tag Processor calls this method to re-scan a tag and its attributes, it leads to a broken stack.

This commit replaces the call to `::next_tag()` with a more appropriate reapplication of its internal parsing logic to rescan the tag name and its attributes. Given the limited nature of what's occurring in `::get_updated_html()`, this should bring with it certain guarantees that no HTML structure is being changed (that structure will only be changed by subclasses like the HTML Processor).

Follow-up to [56274], [56702].

Props dmsnell, zieladam, nicolefurlan.
Fixes #59607.
Built from https://develop.svn.wordpress.org/trunk@56941


git-svn-id: http://core.svn.wordpress.org/trunk@56452 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 14:01:27 +00:00
Peter Wilson
09554030d4 Twenty Thirteen, Twenty Sixteen: Use default display for summary element.
Within the details block, style the `summary` element using the default display, `list-item`, this ensures the toggle icon appears indicating the summary can be expanded or contracted.

Props ankit-k-gupta, nicolefurlan, poena, sabernhardt.
Fixes #58915.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 04:43:22 +00:00
costdev
13854cd7f5 Posts, Post Types: Don't force trailing slash in get_pagenum_link().
Previously, a trailing slash was appended to the link returned from `get_pagenum_link()`. If the permalink structure didn't contain a trailing slash, this link could fail.

This change removes trailing slashes and only appends one if the site is set for adding trailing slashes.

This adds a new test file for the accompanying tests, `tests/phpunit/tests/link/getPagenumLink.php`, and moves an existing test for `get_pagenum_link()` to the same file.

Props davemad-davenet, darkfate, Nazgul, scribu, nacin, obenland, chriscct7, jesin, matthewppelsheimer, audrasjb, petitphp, mukesh27, oglekler, mai21, webtechpooja, tejwanihemant, nicolefurlan, hellofromTonya, costdev.
Fixes #2877.
Built from https://develop.svn.wordpress.org/trunk@56939


git-svn-id: http://core.svn.wordpress.org/trunk@56450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-16 00:07:26 +00:00
hellofromTonya
464868a475 Code Modernization: Declare dynamic properties on WP_Text_Diff_Renderer_Table.
Core uses 3 known, named, dynamic properties on the `WP_Text_Diff_Renderer_Table` class:

* `_title`
* `_title_left`
* `_title_right`

When reviewing revisions (within the admin UI), `wp_text_diff()` passes the arguments (without the leading `_`) to a new instance, which raised deprecation notices (see [56354]).

Note: the parent class adds the leading `_` to each of these properties (see [7747]).

The deprecation notices are resolved by declaring each of these known, named, dynamic properties on the class, per the #56034 mitigation strategy. These new properties are not initialized to retain their previous `null` behavior.

Follow-up to [56354], [23506], [7747].

Props wildworks, antonvlasenko, hellofromTonya, ironprogrammer, kafleg, mukesh27, nicolefurlan, presskopp, sabernhardt.
Fixes #59431.
See #58898, #56034.
Built from https://develop.svn.wordpress.org/trunk@56938


git-svn-id: http://core.svn.wordpress.org/trunk@56449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-15 14:55:23 +00:00
hellofromTonya
23ac8fbfe6 Users: Show "Password reset link sent" message only when finished.
When an admin sends a password reset link to a user (from the Users UI screen), the "finished" UI message:

>Password reset link sent.

is displayed on "finished" and no longer displayed on error.

**What is the change?**

Previously, the conditional (for incrementing the reset counter) checked for a truthy return from `retrieve_password()`. But `retrieve_password()` always returns a truthy state: `true` (meaning "finished") or an instance of `WP_Error`. Thus, checking for a truthy meant the "finished" message was sent on both "finished" and error/failed.

This fix checks for `retrieve_password()` returning `true` to indicate "finished".

**What is displayed on error?**

If `retrieve_password()` returns an instance of `WP_Error`, the following UI message is shown:

>Password reset links sent to 0 users.

The UI messages were not modified by this changeset.

Follow-up to [50129].

Props letraceursnork, prashantbhivsane, audrasjb, costdev, dilipbheda, hareesh-pillai, hellofromTonya, ironprogrammer, huzaifaalmesbah, marybaum, nicolefurlan, oglekler, petitphp, SergeyBiryukov.
Fixes #58407.
Built from https://develop.svn.wordpress.org/trunk@56937


git-svn-id: http://core.svn.wordpress.org/trunk@56448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-15 14:04:23 +00:00
Sergey Biryukov
d80a03fa4f Tests: Reset the current user before performing assertions in some comment tests.
This aims to avoid affecting other tests in case of failure.

Follow-up to [54527].

See #58955.
Built from https://develop.svn.wordpress.org/trunk@56936


git-svn-id: http://core.svn.wordpress.org/trunk@56447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-15 08:09:27 +00:00
Sergey Biryukov
00cabf08ae Twenty Nineteen: Correctly display default color names in the color palette.
Instead of displaying the color names, two of the default colors displayed the color code, which was only intended to show when the user has enabled the custom color option in the Customizer.

The reason is that the default value for the option is `false`, and this value is changed to the string `'custom'` if the color option is enabled, and the string `'default'` if the custom color is enabled and then reset to default colors.

This commit adjusts the logic for displaying the color name, to make sure that the string value `'default'` is not compared with `false`, by adding the default value as a parameter to `get_theme_mod( 'primary_color' )`.

Follow-up to [45964].

Props poena, mukesh27, ugyensupport, shailu25, anveshika, harshgajipara, nicolefurlan, syamraj24, balub, vivekawsm.
Fixes #59566.
Built from https://develop.svn.wordpress.org/trunk@56935


git-svn-id: http://core.svn.wordpress.org/trunk@56446 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-14 12:22:27 +00:00
Pascal Birchler
7a3a97592d Build/Test Tools: Do not round percentages when comparing performance test results.
Props joemcgill.
See #59517.
Built from https://develop.svn.wordpress.org/trunk@56934


git-svn-id: http://core.svn.wordpress.org/trunk@56445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 20:05:23 +00:00
Weston Ruter
793eaf7f19 Script Loader: Move delayed head script to footer when there is a blocking footer dependent.
This prevents a performance regression when a blocking script is enqueued in the footer which depends on a delayed script in the `head` (with `async` or `defer`). In order to preserve the execution order, a delayed dependency must fall back to blocking when there is a blocking dependent. But since it was originally delayed (and thus executes similarly to a footer script), it does not need to be in the head and can be moved to the footer. This prevents blocking the critical rendering path.

Props adamsilverstein, westonruter, flixos90.
Fixes #59599.
See #12009.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 18:46:21 +00:00
Weston Ruter
a17a3ca214 Script Loader: Enqueue inline style for block template skip link in head instead of footer.
* Introduce `wp_enqueue_block_template_skip_link()` to replace `the_block_template_skip_link()`. Add to `wp_enqueue_scripts` action instead of `wp_footer`.
* Keep inline script for skip link in footer.
* Restore original `the_block_template_skip_link()` from 6.3 and move to `deprecated.php`.
* Preserve back-compat for unhooking skip-link by removing `the_block_template_skip_link` from `wp_footer` action.

Follow-up to [56682] and [56687].

Props sabernhardt, plugindevs, westonruter, spacedmonkey.
Fixes #59505.
See #58775.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 17:21:22 +00:00
Felix Arntz
0ade48d1e2 Themes: Clear existing pattern cache when in theme development mode and prevent PHP warning due to missing file.
Follow up to [56765].

Props spacedmonkey, afercia, jrf, flixos90.
Fixes #59591.
See #59490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 16:46:25 +00:00
Pascal Birchler
50694cec94 Build/Test Tools: Fix path check when comparing performance test results.
This is a follow-up to r56926, r56927, r56928.

See #59517.
Built from https://develop.svn.wordpress.org/trunk@56930


git-svn-id: http://core.svn.wordpress.org/trunk@56441 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 12:34:22 +00:00
Sergey Biryukov
163f5e566f Media: Consistently call the wp_create_file_in_uploads hook as a filter.
The filter was initially introduced for file replication purposes. Since the returned value is not always used directly, some instances were later converted to an action as part of removing unused variables, and the hook was documented as an action while still being called as a filter in other instances.

This commit aims to correct the discrepancy between the code and the documentation.

Follow-up to [4673], [4817], [4818], [6363], [6551], [13041], [25821], [33154], [33280].

Props Howdy_McGee, nicolefurlan, johnbillion, mhshujon, SergeyBiryukov.
Fixes #57775.
Built from https://develop.svn.wordpress.org/trunk@56929


git-svn-id: http://core.svn.wordpress.org/trunk@56440 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 12:20:20 +00:00
Pascal Birchler
7fb21f4110 Build/Test Tools: Fix file prefix handling in performance test results.
This is a follow-up to r56926.

See #59517.
Built from https://develop.svn.wordpress.org/trunk@56928


git-svn-id: http://core.svn.wordpress.org/trunk@56439 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 11:30:23 +00:00
Pascal Birchler
ed4ba3bf53 Build/Test Tools: Revert accidental change to Gruntfile.js
This is a follow-up to r56926.

See #59517.
Built from https://develop.svn.wordpress.org/trunk@56927


git-svn-id: http://core.svn.wordpress.org/trunk@56438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 08:15:21 +00:00
Pascal Birchler
afec89634b Build/Test Tools: Migrate Puppeteer tests to Playwright.
As per the migration plan shared last year, this migrates all browser-based tests in WordPress core to use Playwright.
This includes end-to-end, performance, and visual regression tests.

Props swissspidy, mamaduka, kevin940726, bartkalisz, desrosj, adamsilverstein.
Fixes #59517.
Built from https://develop.svn.wordpress.org/trunk@56926


git-svn-id: http://core.svn.wordpress.org/trunk@56437 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 08:13:28 +00:00
Peter Wilson
4258f31a3b Query: Cache post parent IDs in posts group.
Move the cache of post parent IDs from the dedicated group `post_parents` to `posts`. This maintains backward compatibility for clearing all post object related data by calling `wp_cache_flush_group( 'posts' )`.

Post parent IDs are now cached with with the prefix `post_parent:` in the `posts` group.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 23:41:23 +00:00
Aaron Jorbin
929aa8b970 Post WordPress 6.4 Beta 4 version bump.
Built from https://develop.svn.wordpress.org/trunk@56923


git-svn-id: http://core.svn.wordpress.org/trunk@56434 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 20:49:22 +00:00
Aaron Jorbin
d5a5b22dc0 WordPress 6.4 Beta 4.
Built from https://develop.svn.wordpress.org/trunk@56922


git-svn-id: http://core.svn.wordpress.org/trunk@56433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 20:27:25 +00:00
Bernhard Reiter
8a7d30c7f8 Patterns: Don't inject theme attribute on frontend.
Having the patterns registry inject the `theme` attribute into all Template Part blocks inside every pattern was found to negatively impact performance. It turns out that it's only required for the editor (i.e. in the REST API) but not on the frontend; there, it's instead possible to fall back to the currently active theme.

The latter change was made to the Pattern and Template Part blocks in https://github.com/WordPress/gutenberg/pull/55217, which was sync'ed to Core in [56849]. Consequently, this changeset removes `theme` attribute insertion from the frontend.

Props flixos90, gziolo, dmsnell, hellofromtonya.
Fixes #59583.
Built from https://develop.svn.wordpress.org/trunk@56896


git-svn-id: http://core.svn.wordpress.org/trunk@56407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 18:44:45 +00:00
hellofromTonya
5ac76255a9 Editor: Update npm packages ahead of 6.4 RC1.
Updates the npm packages and code for:

* [https://github.com/WordPress/gutenberg/pull/55121 List: fix forward merging of nested list]

* [https://github.com/WordPress/gutenberg/pull/55182 Update consent string for using private APIs.]

* [https://github.com/WordPress/gutenberg/pull/55204 useBlockSettings: add missing useMemo dependencies]

* [https://github.com/WordPress/gutenberg/pull/55120 Remove the lightbox filter and view file when the lightbox setting is disabled.]

* [https://github.com/WordPress/gutenberg/pull/55245 Patterns: Remove the version enforcement for npm in engines field]

* [https://github.com/WordPress/gutenberg/pull/55237 Remove `@return void` from PHP function docs]

* [https://github.com/WordPress/gutenberg/pull/55141 Image: Disable lightbox editor UI for linked images]

* [https://github.com/WordPress/gutenberg/pull/55269 Image: Stop crashing with Lightbox on image blocks without an image]

* [https://github.com/WordPress/gutenberg/pull/55021 Update fullscreen icon]

* [https://github.com/WordPress/gutenberg/pull/55217 Template Part block: Fall back to current theme if no theme attribute is given.] This change is part of fix for a performance regression re-introduced by [56818].

References:
* [https://github.com/WordPress/gutenberg/pull/55298 Gutenberg PR 55298] Cherry-pick commits

Follow-up to [56818], [56816].

Props ellatrix, peterwilsoncc, jsnajdr, afercia, gziolo, isabel_brison, artemiosans, richtabor, bernhard-reiter, flixos90, mikachan, spacedmonkey, hellofromTonya.
See #59583, #59411.
Built from https://develop.svn.wordpress.org/trunk@56849


git-svn-id: http://core.svn.wordpress.org/trunk@56361 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 13:58:15 +00:00
desrosj
5a306cc56d Editor: Move footnotes block hooks to default-filters.php
Follow up to [56839].
Built from https://develop.svn.wordpress.org/trunk@56845


git-svn-id: http://core.svn.wordpress.org/trunk@56357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 13:28:23 +00:00
Aaron Jorbin
9f7edd0413 Editor: Harden the display of footnotes.
Props: jorgefilipecosta, peterwilsoncc, costdev, xknown, jorbin.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56351 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:58:23 +00:00
audrasjb
f3ccbed586 Shortcodes: Restrict ajax handler for media shortcode.
Props tykoted, xknown, peterwilsoncc, antpb, jorbin.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56350 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:47:21 +00:00
Aaron Jorbin
bd5486577c Application Passwords: Prevent the use of some pseudo protocols in application passwords.
Props tykoted, xknown, peterwilsoncc, jorbin, timothyblynjacobs, martinkrcho, paulkevan, dd32, ehtis.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:41:18 +00:00
audrasjb
4f5be9b7de Comments: Prevent users who can not see a post from seeing comments on it.
Props peterwilsoncc, jorbin, audrasjb.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:38:21 +00:00
Aaron Jorbin
0b35c4e2bf Prevent unintended behavior when certain objects are unserialized.
Props ehtis, xknown.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:34:33 +00:00
Aaron Jorbin
3f1e6a6a50 REST API: Ensure no-cache headers are sent when methods are ovverriden.
Props tykoted, xknown, ehtis, timothyblynjacobs, peterwilsoncc, rmccue, jorbin.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:32:32 +00:00
audrasjb
4cfb52760f REST API: Limit search_columns for users without list_users.
Props Vortfu, jorbin, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 12:30:20 +00:00
Sergey Biryukov
598f1aeeb9 Twenty Nineteen: Add margins to editor iframe content.
At screen widths of at least 768px (tablet size), Twenty Nineteen should have a `max-width` and side margins for content in the post editor.

This commit applies that style to the new `.block-editor-iframe__body` class, resolving an issue where full-width blocks had a horizontal scrollbar in the editor iframe.

Props sabernhardt, smit08, nidhidhandhukiya, mukesh27, darshitrajyaguru97, oglekler, poena, shailu25, nicolefurlan.
Fixes #59449.
Built from https://develop.svn.wordpress.org/trunk@56832


git-svn-id: http://core.svn.wordpress.org/trunk@56344 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 10:17:27 +00:00
desrosj
b918d61236 Build/Test Tools: Remove hardcoded PHPUnit config files.
The configuration file passed to the callable workflow contains the correct one to use.

See #58955.
Built from https://develop.svn.wordpress.org/trunk@56831


git-svn-id: http://core.svn.wordpress.org/trunk@56343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 18:09:24 +00:00
desrosj
3e66d7d2e4 Build/Test Tools: Increase the timeout for the failed workflow.
Following [56829], the previous `timeout-minutes` value of `5` is insufficient when approaching 10 retries.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56342 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 17:15:27 +00:00
desrosj
099146c20a Build/Test Tools: Increase the number of retries when restarting a workflow.
This increases the number of times to retry restarting a workflow from 2 to 10. Retries use exponential backoff to space out retries.

In most cases, only 2 retries was sufficient. However, there are occasionally scenarios where the original workflow is still running and cannot be restarted, resulting in an error. This typically happens during periods of ongoing service degradation, or workflows with a significant number of jobs (GitHub Actions is sometimes very slow to mark these as finished).

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


git-svn-id: http://core.svn.wordpress.org/trunk@56341 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 15:56:24 +00:00
Felix Arntz
eae31174d2 Editor: Add further test coverage for wp_render_elements_support().
Props dmsnell, aaronrobertshaw.
Fixes #59578.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 15:15:30 +00:00
desrosj
6a66e05d41 Build/Test Tools: Don’t send Slack notification for workflow retries.
[56780] changed Slack failure notifications to not send a failure notification during the first run of a workflow. Because workflows automatically restart once, a failure during the first run can be ignored.

This adjusts the workflow to also not send a “fixed” notification when the second run of a workflow succeeds after a failure. Because the original failure is no longer reported, these notifications are unnecessary.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 12:17:24 +00:00
Sergey Biryukov
a6b095398c Help/About: Ensure that focus outline on the Credits screen is not cut off.
Props ivanzhuck, oglekler, wildworks, dhrumilk, audrasjb, tejadev, ankit-k-gupta, sumitbagthariya16, mukesh27, marybaum.
Fixes #59033.
Built from https://develop.svn.wordpress.org/trunk@56826


git-svn-id: http://core.svn.wordpress.org/trunk@56338 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 10:43:28 +00:00
costdev
ecd4a277b7 Docs: Use US spelling and correct a typing mistake.
This changes two inline comments and a docblock so that they use US spelling as advised by the Core Handbook's Best Practices. A typing mistake is also corrected.

Reference:
- [https://make.wordpress.org/core/handbook/best-practices/spelling/ Core Handbook - Best Practices - Spelling].

Follow-up to [18632], [38120], [44954].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 07:05:25 +00:00
costdev
b8b4a92895 Plugins: Fix broken sprintf() call in plugins list table.
In [56599], a `sprintf()` call was modified which resulted in an insufficient number of arguments.
This caused a Fatal Error when an incompatible plugin notice was displayed.

This fixes the `sprintf()` call.

Follow-up to [56599].

Props petitphp, TobiasBg, sabernhardt, mukesh27.
Fixes #59590. See #57791.
Built from https://develop.svn.wordpress.org/trunk@56824


git-svn-id: http://core.svn.wordpress.org/trunk@56336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-11 04:33:32 +00:00
desrosj
f92fb81019 Build/Test Tools: Correct variable typo.
This was causing the version of WordPress being tested to be listed as `latest` even when that is not the case.

Props davidbaumwald.
See #58977.
Built from https://develop.svn.wordpress.org/trunk@56823


git-svn-id: http://core.svn.wordpress.org/trunk@56335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 17:32:22 +00:00
Tammie Lister
21bb310d1a Post WordPress 6.4 Beta 3 version bump.
Built from https://develop.svn.wordpress.org/trunk@56822


git-svn-id: http://core.svn.wordpress.org/trunk@56334 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 16:36:22 +00:00
Tammie Lister
c90823fddb WordPress 6.4 Beta 3.
Built from https://develop.svn.wordpress.org/trunk@56821


git-svn-id: http://core.svn.wordpress.org/trunk@56333 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 16:14:22 +00:00
hellofromTonya
86dd8154df Update/Install: Deactivate Gutenberg plugin version older than 16.5.
This commit changes the Gutenberg minimum compatible version number from 14.1 (introduced in [54790]) to 16.5. For versions older than 16.5, the plugin will deactivate when upgrading WordPress to 6.4-beta3 or newer.

Changes are done within Core's `_upgrade_core_deactivate_incompatible_plugins()` which is invoked during WordPress' upgrade process.

Follow-up to [54790].

Props hellofromTonya, spacedmonkey.
Fixes #59584.
Built from https://develop.svn.wordpress.org/trunk@56820


git-svn-id: http://core.svn.wordpress.org/trunk@56332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 15:07:24 +00:00
spacedmonkey
6e774df98c REST API: Fix issue with Template and Template Part Revision/Autosave REST API controllers.
The Template and Template Part REST API controllers have unique characteristics compared to other post type REST API controllers. They do not rely on integer IDs to reference objects; instead, they use a combination of the theme name and slug of the template, like 'twentytwentyfour//home.' Consequently, when the post types template and template part were introduced in [52062], it led to the registration of REST API endpoints for autosaves and revisions with invalid URL structures.

In this commit, we introduce new functionality to enable custom autosave and revisions endpoints to be registered at the post type level. Similar to the 'rest_controller_class' parameter, developers can now define 'revisions_rest_controller' and 'autosave_rest_controller.' This empowers developers to create custom controllers for these functionalities. Additionally, we introduce a 'late_route_registration' parameter, which proves helpful when dealing with custom URL patterns and regex pattern matching issues.
This commit registers new classes for template and template part autosave and revisions controllers, differentiating them from standard controllers in the following ways:
* The response shape now matches that of the template controller.
* Permission checks align with the template controller.
* A custom URL pattern is introduced to support slug-based identification of templates.

Furthermore, we've updated the utility function '_build_block_template_result_from_post' to support passing revision post objects. This enhancement ensures compatibility with the custom revisions controller.

Props spacedmonkey, revgeorge, andraganescu, hellofromTonya, antonvlasenko, kadamwhite, ironprogrammer, costdev, mukesh27, timothyblynjacobs, adamsilverstein. 
Fixes 56922.
Built from https://develop.svn.wordpress.org/trunk@56819


git-svn-id: http://core.svn.wordpress.org/trunk@56331 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 14:05:21 +00:00
Bernhard Reiter
b44637c00c Patterns: Inject theme attribute into Template Part blocks.
[56805] introduced a regression: The `theme` attribute was no longer injected into Template Part blocks inside of patterns. This caused errors on the frontend, where instead of a given template part, an error message such as `Template part has been deleted or is unavailable: header` was seen.

This changeset rectifies that problem, and adds unit test coverage to guard against future regressions.

Follow-up to [56805].
Props scruffian, gziolo.
Fixes #59583.
Built from https://develop.svn.wordpress.org/trunk@56818


git-svn-id: http://core.svn.wordpress.org/trunk@56330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 13:21:22 +00:00
hellofromTonya
eb9aaa5f9e Options, Meta APIs: Check setting group exists before search in unregister_setting().
Checks if the given `$option_group` exists before searching for the `$option_name`. Sets the `$pos` to `false`, as `array_search()` returns `false` if the option name (needle) does not exist.

This changeset fixes 2 different PHP Warning|Notice scenarios:
1. When the global `$new_allowed_options` is `null`, fixes raising `Trying to access array offset on value of type null` PHP Notice (PHP 7.4) | Warning (on PHP 8).

2. When the global `$new_allowed_options` is an `array` and the setting group key does not exist, fixes raising "Undefined index: unknown_setting_group" PHP Notice (PHP 7) | Warning (on PHP 8).

For both scenarios, the `array_search()` is skipped and the `$pos` is set to a default of `false`, i.e. which is the value returned when `array_search()` is unsuccessful.

Props xknown, hellofromTonya, nicolefurlan, oglekler, SergeyBiryukov, shailu25.
Fixes #57674.
Built from https://develop.svn.wordpress.org/trunk@56817


git-svn-id: http://core.svn.wordpress.org/trunk@56329 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 12:52:25 +00:00
Tammie Lister
6468f40e61 Update editor related npm packages for beta 3 second part.
The npm packages needed a second part to the update for beta 3 in preparation for 6.4.

Props talldan, ellatrix, santosguillamot, ramonopoly, andrewserong, artemiosans, isabel_brison, mikachan.

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 11:30:19 +00:00
Sergey Biryukov
330f070340 Query: Ensure that the page parameter is scalar in WP_Query::get_posts().
The `page` query var only accepts a scalar value and passes the value through functions that assume a scalar value.

Adding an extra guard condition does not affect its functionality but does avoid a PHP fatal error for `trim()` when a non-scalar value such as an array is passed.

Follow-up to [2535], [53891].

Props brookedot, rlmc, mukesh27, SergeyBiryukov.
Fixes #56558.
Built from https://develop.svn.wordpress.org/trunk@56815


git-svn-id: http://core.svn.wordpress.org/trunk@56327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 11:22:24 +00:00
spacedmonkey
57ecd6c091 Options, Meta APIs: Prevent unnecessary database updates caused by strict comparisons in update_network_option.
Previously, in the update_network_option function, strict comparisons between old and new values could erroneously trigger updates in cases where there was no actual change in values. Building upon the groundwork laid in #22192, this commit introduces the use of the _is_equal_database_value function to accurately compare values before initiating any database updates. This change ensures consistency between the behaviors of `update_option` and `update_network_option`.

Furthermore, we have incorporated similar workarounds that were previously implemented in [56717]. These changes ensure that the raw version of network option values is considered in the comparisons, enhancing the overall reliability of the update process.

Props mukesh27, flixos90, joemcgill, costdev, spacedmonkey.
Fixes #59360.
Built from https://develop.svn.wordpress.org/trunk@56814


git-svn-id: http://core.svn.wordpress.org/trunk@56326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 09:37:22 +00:00
Tammie Lister
e34caad13c Changes to TT4 for beta 3.
Updates TT4 with additional changes ready for beta 3.

Props jessplease, pbwebd, poena, afercia, luminuu, beafialho, onemaggie, mhkuu,  richtabor,  benoitchantre.

Close #59575.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 09:03:25 +00:00
isabel_brison
5951111cba Editor: fix incorrect block custom CSS output.
Fixes output of block custom CSS when multiple rules require a descendant selector.

Props wildworks, mikachan.
Fixes #59499.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-10 03:43:22 +00:00
Peter Wilson
61658a27a3 Query: Rename _prime_post_parents_caches() for clarity.
Change the name of `_prime_post_parents_caches()` to `_prime_post_parent_id_caches()` to make it clearer only the parent post ID is cached rather than the entire post parent object.

Follow up to [56763].

Props spacedmonkey, joemcgill, peterwilsoncc.
See #59188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56323 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 23:04:16 +00:00
joedolson
203ae545d2 Administration: Fix unusable mobile admin menu in Safari.
Replace the `focusout` event handler added in [55326] with a combination of `blur` and `keyup` handler. This change handles Safari not setting focus on clicked elements.

Props afercia, joedolson, travel_girl, oglekler, rajinsharwar, marybaum, rcorrales, binsaifullah, shubhamsedani, ashikur698.
Fixes #58912.
Built from https://develop.svn.wordpress.org/trunk@56810


git-svn-id: http://core.svn.wordpress.org/trunk@56322 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 23:02:26 +00:00
Weston Ruter
2869e3a186 Administration: Remove deprecated unload event handlers and use pagehide (and pageshow) when appropriate.
Use `pagehide` event instead of `unload` in the following cases:

* For classic editor to release the post lock.
* In Text widget to rebuild editor after dragging widget to new location in classic widgets interface.
* To clear out the `window.name` when navigating away from a post preview.
* To suspend heartbeat, while also using `pageshow` event to resume as if it had been a focused tab in case page restored from bfcache. 

Also:

* Remove obsolete mobile cleanup code in `js/_enqueues/lib/gallery.js` (introduced in [9894]). Do same for `src/js/_enqueues/wp/media/models.js` (introduced in [22872]). See #22552.
* Remove obsolete Firefox-specific workaround in `js/_enqueues/wp/mce-view.js` from [39282]. See #38511.

Fixes #55491.
Props spenserhale, westonruter, adamsilverstein, azaozz, shawfactor, peterwilsoncc, swissspidy.
Built from https://develop.svn.wordpress.org/trunk@56809


git-svn-id: http://core.svn.wordpress.org/trunk@56321 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 21:31:27 +00:00
Tammie Lister
d605f96c0f Update npm packages to latest versions for 6.4 beta 3.
The npm packages needed a further update for beta 3 in preparation for 6.4.

Props @richtabor, @mmaattiiaass, @tellthemachines, @mamaduka, @swissspidy, @scruffian, @andraganescu, @andrewserong, @mujuonly, @get_dave, @ntsekouras, @carlosgprim, @ramonopoly, @jameskoster, @wildworks, @aaronrobertshaw, @czapla, @santosguillamot, @artemiosans, @afercia, @glendaviesnz, @kevin940726, @mikachan, @siobhyb.

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56320 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 17:24:24 +00:00
Felix Arntz
d783a65dd9 Editor: Improve performance of wp_render_elements_support().
By skipping iterations in block supports when not necessary, this changeset improves performance of the function notably.

The performance enhancement leads to even a notable improvement for overall page load time: For example, the Twenty Twenty-Four home page loads ~2% faster with this changeset.

Props dmsnell, spacedmonkey, costdev, hellofromTonya, aaronrobertshaw.
Fixes #59544.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 17:07:22 +00:00
Felix Arntz
5ba13b5683 Editor: Add additional unit tests for elements block support.
Props aaronrobertshaw, costdev.
Fixes #59555.
See #59544.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 16:41:44 +00:00
Bernhard Reiter
fc229aa436 Blocks: Call get_hooked_blocks only once per template/part/pattern.
Prior to this changeset, `get_hooked_blocks` was called four times ''for every parsed block'' in each template, template part, and pattern. With this changeset applied, `get_hooked_blocks` is called only once per template, template part, or pattern.

Additionally, `get_hooked_blocks` is called only once when returning the list of all registered patterns. (The latter modification brings the implementation closer to its state prior to Block Hooks.)

Finally, when there are no registered hooked blocks or `hooked_block_types` filters, parsing, hooked block insertion, and re-serializing is skipped altogether.

Props gziolo, flixos90, joemcgill, dmsnell, spacedmonkey, hellofromtonya.
Fixes #59383.
Built from https://develop.svn.wordpress.org/trunk@56805


git-svn-id: http://core.svn.wordpress.org/trunk@56317 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 16:40:24 +00:00
K. Adam White
e0596b5835 REST API: Correct parsing of password from Authorization header when processing Application Password credentials.
Exit early when parsing Application Password credentials if Authorization header value does not contain at least one colon. The `Authorization` Basic header must use a colon to separate the username and password components per RFC 7617, so a username-only string is malformed and should not be processed.

Split `Authorization` header only on the first colon, properly handling passwords containing colons.

Resolves PHP 8.0 warning when `list()` was called on an exploded credentials array containing only one element.

Props kalpeshh, shooper, sc0ttkclark, jrf, mukesh27, oglekler, nicolefurlan.
Fixes #57512.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 14:49:26 +00:00
Sergey Biryukov
d1b13a270a Code Modernization: Update parameter names in the WP_Block_List class.
This makes the parameter names consistent with the `ArrayAccess` interface.

Reference: [https://www.php.net/manual/en/class.arrayaccess.php PHP Manual: The ArrayAccess interface].

Follow-up to [48159].

Props rahmohn.
See #58976.
Built from https://develop.svn.wordpress.org/trunk@56803


git-svn-id: http://core.svn.wordpress.org/trunk@56315 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-09 11:23:28 +00:00
joedolson
074d2adb95 Quick/Bulk Edit: Fix inability to quick edit draft post date.
Follow up to [56022] to fix inability to set a date/time in quick editing. Allow a user to set a quick/edit date while preventing accidental date assignments per the original intent.

Props tristanleboss, ivanzhuck, tibbsa, sabernhardt, sergeybiryukov, oandregal, khokansardar, joedolson, shailu25.
Fixes #59125. See #19907.
Built from https://develop.svn.wordpress.org/trunk@56802


git-svn-id: http://core.svn.wordpress.org/trunk@56314 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-08 20:10:25 +00:00
joedolson
f99b282ca2 Upload: Fix misalignment of 'Copied' message.
Add `display: flex` to `.copy-to-clipboard-container` to fix alignment of elements within the container.

Props sujichandran14, oglekler, sarathar, huzaifaalmesbah, nicolefurlan, joemcgill, dkotter.
Fixes #58829.
Built from https://develop.svn.wordpress.org/trunk@56801


git-svn-id: http://core.svn.wordpress.org/trunk@56313 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-08 18:21:23 +00:00
joedolson
eb4db82558 Administration: Add missing space in theme activation notices.
Restore missing space in two admin notices during theme activation.

Props shailu25, sergeybiryukov, mukesh27, hellofromtonya.
Fixes #59501. See #57791.
Built from https://develop.svn.wordpress.org/trunk@56800


git-svn-id: http://core.svn.wordpress.org/trunk@56312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-08 17:56:24 +00:00
Sergey Biryukov
bc26809c97 Coding Standards: Upgrade WPCS to version 3.0.1.
In WordPressCS 3.0.0, the functionality of the `WordPress.Security.EscapeOutput` sniff was updated to report unescaped message parameters passed to exceptions created in `throw` statements. This specific violation now has a separate error code: `ExceptionNotEscaped`. This will allow users to ignore or exclude that specific error code.

The error code(s) for other escaping issues flagged by the sniff remain unchanged.

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

Follow-up to [56695].

Props jrf, bjorsch, dawidurbanski.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56799


git-svn-id: http://core.svn.wordpress.org/trunk@56311 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-08 13:09:25 +00:00
Sergey Biryukov
6d0770e8df Coding Standards: Correct alignment in wp-admin/user-edit.php.
This resolves a WPCS warning:
{{{
Array double arrow not aligned correctly;
expected 1 space(s) between "'type'" and double arrow, but found 15.
}}}

Follow-up to [56570], [56680].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56310 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-07 13:55:30 +00:00
Felix Arntz
e855a6f289 Options, Meta APIs: Add test coverage for update_network_option() comparison of new and existing value.
Having those tests in `trunk` already will help ensure potential future fixes to this logic maintain backward compatibility.

Props mukesh27, spacedmonkey.
See #59360.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56309 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-06 17:03:18 +00:00
Felix Arntz
cfbd76d97c Options, Meta APIs: Fix bug with update_option() updating the wrong cache, leading to potentially stale values being returned.
When using the `$autoload` parameter of `update_option()` alongside an option value update, prior to this changeset the function would update the incorrect cache, not respecting the new autoload value. This could have severe implications such as returning a stale option value when the option in fact had already been deleted.

This changeset fixes the bug alongside test coverage that failed with `trunk` but now passes.

Props kkmuffme, pentatonicfunk, SergeyBiryukov, oglekler, azaozz, spacedmonkey, nicolefurlan, joemcgill, flixos90.
Fixes #51352.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-06 16:33:25 +00:00
Sergey Biryukov
5c4f902c20 Editor: Move wp_navigation schema updating to WP_Navigation_Fallback class.
This aims to better align the navigation fallback implementation with core architecture and best practices.

The function that updates the `wp_navigation` post response schema is now a public method of the `WP_Navigation_Fallback` class, so an extra file previously used for that specific function is no longer necessary.

Follow-up to [56052].

Props ramonopoly, scruffian, isabel_brison, mukesh27, swissspidy, rajinsharwar, afercia, audrasjb, mikeschroder, JeffPaul, johnjamesjacoby, TimothyBlynJacobs, oglekler, SergeyBiryukov.
Fixes #58910.
Built from https://develop.svn.wordpress.org/trunk@56793


git-svn-id: http://core.svn.wordpress.org/trunk@56305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-06 14:06:22 +00:00
desrosj
67c2237b52 Build/Test Tools: Check for zero-byte files in themes.
Because the contents of binary files are not included in patches by default, occasionally empty versions of these files are committed on accident. This is the most commonly happens within default themes because they usually contain image and font files.

This adds a job to the theme related GitHub Action workflow that checks for the presence of zero-byte files so that these instances are caught more easily.

Props costdev, hellofromTonya, luminuu, onemaggie.
Fixes #59527.
Built from https://develop.svn.wordpress.org/trunk@56792


git-svn-id: http://core.svn.wordpress.org/trunk@56304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-06 12:47:25 +00:00
audrasjb
8f66e7884b Twenty Twenty-Three: Add missing font licenses in readme.txt file.
Props benimub.
Fixes #59483.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56303 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 22:46:18 +00:00
Sergey Biryukov
4fd39c6620 HTML API: Rename WP_HTML_Processor::createFragment() to follow WPCS.
`WP_HTML_Processor::create_fragment()` is the correct method name as per the WordPress PHP coding standards.

Follow-up to [56274].

Props dmsnell, jrf, hellofromTonya, SergeyBiryukov.
Fixes #59547.
Built from https://develop.svn.wordpress.org/trunk@56790


git-svn-id: http://core.svn.wordpress.org/trunk@56302 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 22:42:26 +00:00
Felix Arntz
bef632d0cc Options, Meta APIs: Fix minor compatibility issue with update_option() change.
When calling `update_option()` with value `false` on a non-existent option, prior to [56681] the function would have returned `false` and not stored the value in the database, since the given value was the same as the default.

The aforementioned changeset broke that promise with good intention, however this particular change was a backward compatibility break and therefore is resolved here.

Props mukesh27, costdev.
Fixes #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-05 16:15:27 +00:00
Joe McGill
7291a4dfa0 Themes: Fix core block style paths on Windows.
This is a follow-up to [56528], which normalizes the `BLOCKS_PATH` for Windows prior to making paths relative for caches during the registration process. Prior to this change, incorrect file paths would lead to broken styles for core blocks on Windows.

Props wildworks, pbiron, flixos90, joemcgill.
Fixes #59489. See #59111.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 22:23:27 +00:00
audrasjb
a0d3ee6717 Twenty Twenty: Fix style issues within iframed editor.
This changeset:
- Replaces `body` with `html` for the first CSS selector that makes text white against a dark background
- Moves `twentytwenty_block_editor_styles()` from the `enqueue_block_editor_assets` action to `enqueue_block_assets` for WordPress 6.3 and later
- Removes the obsolete `twentytwenty-block-editor-script` from the styles function to avoid an error in the iframe

Props floydwilde, poena, huzaifaalmesbah, greenshady, sabernhardt, audrasjb, pooja1210, shailu25, joemcgill.
Fixes #59086.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56295 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 20:56:24 +00:00
desrosj
3751961f50 Build/Test Tools: Don’t send a Slack notice for a workflow’s first failure.
After [53947], all workflows will automatically be restarted once in an attempt to rule out reasons for failures, such as timeouts or network hiccups.

Second attempt at [56404], which was previously reverted in [56407].
See #58867.
Built from https://develop.svn.wordpress.org/trunk@56780


git-svn-id: http://core.svn.wordpress.org/trunk@56292 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 19:14:21 +00:00
audrasjb
b5bddaa39d Editor: Fix wrong @since mention in remove_insecure_properties().
Follow-up to [56502].

See #59108.




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


git-svn-id: http://core.svn.wordpress.org/trunk@56290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 19:03:26 +00:00
hellofromTonya
ceffccb71f Twenty Twenty-Four: Fix 6.4 Beta 2 image assets.
Fixes the image assets from [56764] for the images to properly render.

Adds binary file contents (resolves 0 bytes issue) and svn:mime-type property:
* abstract-geometric-art.webp
* building-exterior.webp
* hotel-facade.webp
* museum.webp
* tourist-and-building.webp
* windows.webp

Updates the binary file contents for renamed images:
* angular-roof.webp
* art-gallery.webp
* green-staircase.webp

Follow-up to [56764].

Unprops hellofromTonya.
Props onemaggie, luminuu, colorful-tones, desrosj, mukesh27, nendeb55, nicolefurlan, satishprajapati, shailu25.
Fixes #59526.
See #59524.
Built from https://develop.svn.wordpress.org/trunk@56775


git-svn-id: http://core.svn.wordpress.org/trunk@56287 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 17:02:26 +00:00
Sergey Biryukov
4bf7dc11b0 Docs: Use 3-digit, x.x.x style semantic versioning for two @since entries.
Follow-up to [41626], [56541].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56774


git-svn-id: http://core.svn.wordpress.org/trunk@56286 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 15:12:28 +00:00
spacedmonkey
eb0c7d8864 Docs: Improve documentation for _prime_post_parents_caches().
Add in missing since PHPDoc block for `_prime_post_parents_caches` function added in [56763].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 12:16:22 +00:00
Sergey Biryukov
43804e0d08 Twenty Fourteen: Correct @since entry for an authors list query arguments filter.
Follow-up to [51943].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56772


git-svn-id: http://core.svn.wordpress.org/trunk@56284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-04 12:14:24 +00:00
Felix Arntz
3bc56b3de0 Editor: Simplify return shape and logic of _wp_get_block_patterns().
Follow up to [56765].

Props spacedmonkey.
Fixes #59490.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56283 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 18:19:23 +00:00
desrosj
22923ffb9d Build/Test Tools: Test Twenty Twenty-Four.
This adds Twenty Twenty-Four to the Default Theme test workflow in GitHub Actions.

Follow up to [56764], [56726], [56721], [56716].
See #59447.
Built from https://develop.svn.wordpress.org/trunk@56770


git-svn-id: http://core.svn.wordpress.org/trunk@56282 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 18:12:24 +00:00
hellofromTonya
36df581678 Post WordPress 6.4 Beta 2 version bump.
Built from https://develop.svn.wordpress.org/trunk@56769


git-svn-id: http://core.svn.wordpress.org/trunk@56281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 17:09:23 +00:00
hellofromTonya
9396576d8a WordPress 6.4 Beta 2.
Built from https://develop.svn.wordpress.org/trunk@56768


git-svn-id: http://core.svn.wordpress.org/trunk@56280 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 16:32:21 +00:00
Sergey Biryukov
f2a85f2b2c Docs: Improve documentation for get_avatar() and related functions.
Includes:
* Expanding and synchronizing documentation for the `default` and `rating` arguments.
* Adding `@since` entries for the `loading`, `fetchpriority`, and `decoding` arguments.
* Wrapping long lines as per the documentation standards.
* Fixing a typo in the `identicon` value.
* Minor formatting edits for consistency.

Follow-up to [31107], [45632], [47554], [53480], [56037].

See #58833.
Built from https://develop.svn.wordpress.org/trunk@56767


git-svn-id: http://core.svn.wordpress.org/trunk@56279 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 16:15:19 +00:00
hellofromTonya
2a2cbb3b49 Query: Fix a PHPCS issue in _prime_post_parents_caches() tests.
Removes an extraneous line break in the `_prime_post_parents_caches()` tests.

Follow-up to [56763].

Unprops spacedmonkey.
Props mukesh27, costdev.
See #59188.
Built from https://develop.svn.wordpress.org/trunk@56766


git-svn-id: http://core.svn.wordpress.org/trunk@56278 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:44:22 +00:00
spacedmonkey
b0872b005d Editor: Improve performance of _register_theme_block_patterns function.
The `_register_theme_block_patterns` function imposed a significant resource overhead. This issue primarily stems from themes, such as TT4, that register a substantial number of block patterns. These patterns necessitate numerous file operations, including file lookups, file reading into memory, and related processes. To provide an overview, the _register_theme_block_patterns function performed the following file operations:

- is_dir
- is_readable
- file_exists
- glob
- file_get_contents (utilized via get_file_data)

To address these issues, caching using a transient has been added to a new function call `_wp_get_block_patterns`. If theme development mode is disabled and theme exists, the block patterns are saved in a transient cache. This cache is used all requests after that, saving file lookups and reading files into memory. Cache invalidation is done, when themes are switched, deleted or updated. Meaning that block patterns are not stored in the cache incorrectly. 

Props flixos90, joemcgill, peterwilsoncc, costdev, swissspidy, aristath, westonruter, spacedmonkey.
Fixes #59490
Built from https://develop.svn.wordpress.org/trunk@56765


git-svn-id: http://core.svn.wordpress.org/trunk@56277 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:18:19 +00:00
hellofromTonya
67161cc1dd Bundled Themes: Update TT4 for 6.4 Beta 2.
Twenty Twenty-Four (TT4) updates for 6.4 Beta 2.

Changes include bugfixes from the theme's development repo since Beta 1 such as: 
* Renamed patterns and images
* Improved image descriptions
* Polished a few of the templates to fit better the design
* Addressed some a11y concerns.
* Changed the required version to 6.4, aligning it with the last few default themes since we are making use of some of the features that will make it to 6.4, such as aspect ratio.

Follow-up to [56726], [56721], [56716].

Props onemaggie, desrosj, mukesh27.
Fixes #59524.
Built from https://develop.svn.wordpress.org/trunk@56764


git-svn-id: http://core.svn.wordpress.org/trunk@56276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:14:22 +00:00
spacedmonkey
5283300aac Query: Improve caching behavior for WP_Query when retrieving id=>parent fields
In [53941], the addition of query caching to `WP_Query` brought about an unintended issue when querying for fields equal to id=>parent. Specifically, on websites with object caching enabled and a substantial number of pages, the second run of this query triggered the `_prime_post_caches` function for id=>parent. This led to the unnecessary priming of post, meta, and term caches, even when only id and parent information were requested.

This commit addresses this issue by introducing a new function, `_prime_post_parents_caches`, which primes a dedicated cache for post parents. This cache is primed during the initial query execution. Subsequently, the `wp_cache_get_multiple` function is employed to retrieve all post parent data in a single object cache request, optimizing performance.

Additionally, this commit extends the coverage of existing unit tests to ensure the reliability of the changes.

Props kevinfodness, joemcgill, peterwilsoncc, LinSoftware, thekt12, spacedmonkey.
Fixes #59188
Built from https://develop.svn.wordpress.org/trunk@56763


git-svn-id: http://core.svn.wordpress.org/trunk@56275 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 15:01:21 +00:00
Felix Arntz
ddef9ed1f7 Options, Meta APIs: Implement additional tests covering update_option().
As a follow up to [56681], this changeset adds further tests, primarily focused on ensuring no unnecessary database queries are run.

Props mukesh27, costdev, joemcgill, spacedmonkey.
See #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 14:11:25 +00:00
gziolo
c9cbea7627 Tests: Rename and improve the blocks/context.php file to follow handbook
Renames `context.php` and `Tests_Blocks_Context` to `renderBlock.php` and `Tests_Blocks_RenderBlock`. See https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#test-classes. 

Simplifies also the tear_down method by using the same convention as in [56759].

Props costdev, ockham.
Follow-up [48224].
See #49927.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:54:20 +00:00
gziolo
51ca8e0364 Chore: Remove empty test file that was missed after renaming the file
Follow-up [56759].


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


git-svn-id: http://core.svn.wordpress.org/trunk@56272 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:36:20 +00:00
gziolo
04ed4159b4 Tests: Cover Block Hooks integration with a custom block theme
Adds a simplified version of Twenty Twenty-Three theme that helps testing Block Hooks integration. The theme contains:

- The required index.html template.
- The optional single.html template used with tests.
- 3 template parts where two of them reference patterns.
- 3 patterns referenced in the templates and the template parts.

New tests automatically register 4 custom blocks with the test theme where each of them hooks into another block using all four target relative positions: `before`, `after`, `firstChild`, `lastChild`.

The tests verify that the block gets hooked into the correct positions when targeting:

- template
- template part
- pattern

Props ockham, costdev.
See #59313, #59383.
Follow-up [56610].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-03 08:29:23 +00:00
danielbachhuber
e249e1aa28 Editor: Add function prefix to avoid conflicts.
Transforms `initialize_theme_preview_hooks` to `wp_initialize_theme_preview_hooks` to avoid conflicts with third-party code.

Follow up to [56529].

Props okat.
See #59000.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 22:42:24 +00:00
Felix Arntz
dfe1f0d130 Media: Prevent PHP notice in get_avatar().
Follow up fix to [56690].

Props pereirinha, mukesh27, spacedmonkey.
Fixes #58892.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 20:14:21 +00:00
Tammie Lister
ddc07c4598 Update npm packages to latest.
The npm packages needed a further update for beta 2 in preparation for 6.4.

Props @mmaattiiaass , @wildworks , @aaronrobertshaw, @bartkalisz, @mamaduka, @artemiosans, @youknowriad, @czapla, @richtabor, @glendaviesnz, @pbking, @cbravobernal, @madhudollu, @kevin940726, @adamsilverstein, @get_dave, @ntsekouras, @ramonopoly, @jffng, @swissspidy, @carlosgprim, @siobhyb, @mikachan.

See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 18:58:22 +00:00
Felix Arntz
5496e4b70b Script Loader: Fix missing documentation for the $path argument of wp_enqueue_block_style().
See #59466.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56266 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 18:48:24 +00:00
Sergey Biryukov
ffd72aac28 Coding Standards: Remove redundant ignore annotations, take 5.
The `VariableAnalysis` standard is not used by WP Core.

Follow-up to [50958], [51003], [52049], [52051], [52069], [53072], [54132], [55132], [56363], [56738], [56743], [56751], [56752].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56265 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-02 11:27:24 +00:00
Sergey Biryukov
aaba77b577 Coding Standards: Remove redundant ignore annotations, take 4.
This removes ignore annotations related to sniffs which are not used by WP Core (like sniffs in the `WordPress-Extra` ruleset).

Follow-up to [48072], [51003], [55204], [56714].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56264 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-01 00:22:27 +00:00
Sergey Biryukov
97cb448897 Coding Standards: Remove redundant ignore annotations, take 3.
This removes ignore annotations about invalid function names for deprecated functions. Those are ignored by design in WPCS since version 2.2.0.

Follow-up to [45580], [47612], [47927].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56263 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-30 07:39:26 +00:00
Weston Ruter
583ba4dc6d Script Loader: Remove erroneous type attribute from script tag wrapper on login screen.
This was causing a `_doing_it_wrong()` notice from `wp_remove_surrounding_empty_script_tags()`. In fact, the `type` attribute was added in [56748] to test this incorrect usage notice. This commit reverts that change.

Follow-up to [56748].
Unprops westonruter.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 22:01:31 +00:00
Weston Ruter
59557e4c6e Customize: Harden and modernize URL manipulation in WP_Customize_Manager::remove_frameless_preview_messenger_channel().
Since IE11 is no longer supported, the `URL` and `URLSearchParams` APIs can now be leveraged for simpler and more robust URL manipulation. This was done similarly in [56383] for `embed.js`.

Props nicolefurlan, dmsnell, westonruter.
Fixes #59480.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56261 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 21:39:25 +00:00
Weston Ruter
a20cb28d14 Script Loader: Harden removal of script tag wrappers.
* Add `wp_remove_surrounding_empty_script_tags()` to more precisely remove script tag wrappers and warn when doing it wrong.
* Add clarifying comments for XML escaping logic in `wp_get_inline_script_tag()`.
* Leverage `WP_HTML_Tag_Processor` in `test_remove_frameless_preview_messenger_channel`.
* Reuse `assertEqualMarkup` in `test_blocking_dependent_with_delayed_dependency`.
* Normalize whitespace in `parse_markup_fragment` for `assertEqualMarkup`.

Follow-up to [56687].
Props dmsnell, westonruter, flixos90.
See #58664.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56260 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 19:47:21 +00:00
spacedmonkey
8aca3fdc68 Comments: Improve WP_Comment_Query count query performance by setting 'order by' to 'none'.
In cases where `WP_Comment_Query` or `get_comments` is employed with the 'count' parameter set to true, specify 'order by' as 'none'. Since these queries serve solely to determine the count of comments matching specific query parameters, the 'order by' clause becomes redundant and places unnecessary strain on the database server, resulting in slower query execution. Given that count queries are executed on every admin request to retrieve comment counts, this change enhances the performance of the wp-admin interface.

Props guss77, davidbaumwald, SergeyBiryukov, westonruter, peterwilsoncc, foliovision, hareesh-pillai, spacedmonkey.
Fixes #58368
Built from https://develop.svn.wordpress.org/trunk@56747


git-svn-id: http://core.svn.wordpress.org/trunk@56259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 17:13:24 +00:00
Aaron Jorbin
3a3f9b80b7 Tests: Reduce usage of assertEquals
Replaces assertSame with assertCount in a number of tests.

Props ayeshrajans, jorbin.
See #58956.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56258 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 15:24:22 +00:00
Adam Silverstein
472f1ec59d Revisions: slash meta values for autosave (preview) revisions.
Correct an issue where meta values containing characters like quote `”` could not be previewed on published posts. The function `update_metadata` expects data to be slashed.

Also, add a test to confirm that storing JSON data which requires slashing in autosave meta works as expected, and improve naming for a data provider added in [56714].

Follow up to [56714].

Props mukesh27, spacedmonkey.
Fixes #20564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 15:07:26 +00:00
spacedmonkey
d922a9e96a Editor: Avoid Deferring Loading for Empty Block Script URI
In the context of register_block_script_handle, the get_block_asset_url function may return false when an empty string is provided as the input. This behavior is intended to prevent the generation of invalid URLs. However, when the script loading strategy is set to "defer" while passing false, it triggers a "doing it wrong" message.

This situation becomes problematic, especially for scenarios where the scripts haven't been built yet. In such cases, the realpath call returns an empty string because the file doesn't exist. To address this issue, we now perform a simple check to ensure that the script URI is not empty before applying the "defer" loading strategy. This adjustment prevents unnecessary deferral of loading for scripts with empty URIs.

Follow on from [56683] and [56033].

Props kebbet, mukesh27, swissspidy, westonruter, spacedmonkey.
Fixes #59475
Built from https://develop.svn.wordpress.org/trunk@56744


git-svn-id: http://core.svn.wordpress.org/trunk@56256 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 13:15:25 +00:00
Sergey Biryukov
440b8c2aba Coding Standards: Remove redundant ignore annotations, take 2.
This removes ignore annotations which are unnecessary due to the configuration in the `phpcs.xml.dist` ruleset already taking care of this.

Follow-up to [45611], [50146], [50148], [50586], [50822], [56738].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 12:21:24 +00:00
spacedmonkey
e74a3bfdb0 Editor: Replace property_exists calls in block related functions with instanceof
Replace calls to `property_exists` with `instanceof WP_Block_Type` in block related functions. This change not only improves type safety but also enhances performance.

Follow on from [56678] and [56677].

Props gziolo, aristath, aaronrobertshaw, spacedmonkey.
Fixes #59453
Built from https://develop.svn.wordpress.org/trunk@56742


git-svn-id: http://core.svn.wordpress.org/trunk@56254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-29 10:20:30 +00:00
Sergey Biryukov
829bbf3605 Coding Standards: Remove temporary exclusion from the PHPCS ruleset.
Now that the `block-library` package is updated for WP 6.4, this is no longer necessary.

Related PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/53866 #53866 Update WPCS to v3.0, and fix all reported Coding Standards issues]

Follow-up to [56695], [56710].

See #59161.
Built from https://develop.svn.wordpress.org/trunk@56741


git-svn-id: http://core.svn.wordpress.org/trunk@56253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 22:32:22 +00:00
hellofromTonya
c42f8ef694 Code Modernization: Fix "passing null to non-nullable" deprecation from next_posts().
The `esc_url()` function expects to a string for `$url` parameter. There is no input validation within that function. The function contains a `ltrim()` which also expects a string. Passing `null` to this parameter results in `Deprecated: ltrim(): Passing null to parameter #1 ($string) of type string is deprecated` notice on PHP 8.1+.

Tracing the stack back, a `null` is being passed to it within `next_posts()` when `get_next_posts_page_link()` returns `null` (it can return a string or `null`).

On PHP 7.0 to PHP 8.x, an empty string is returned from `esc_url()` when `null` is passed to it. The change in this changeset avoids the deprecation notice by not invoking `esc_url()` when `get_next_posts_page_link()` returns `null` and instead sets the `$output` to an empty string, thus maintain the same behavior as before (minus the deprecation notice).

Adds a test to validate an empty string is returned and the absence of the deprecation (when running on PHP 8.1+).

Follow-up to [11383], [9632].

Props codersantosh, nihar007, hellofromTonya, mukesh27, oglekler, rajinsharwar.
Fixes #59154.
Built from https://develop.svn.wordpress.org/trunk@56740


git-svn-id: http://core.svn.wordpress.org/trunk@56252 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 21:26:25 +00:00
gziolo
1050b47e06 General: Set the correct script version for regenerator-runtime
Follow-up for [56710]. Brings back the version specified in the `package.json` file.

Props ockham.
See #59411.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56251 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 08:35:23 +00:00
Sergey Biryukov
11f30a677a Coding Standards: Remove redundant ignore annotations.
This removes ignore annotations which are ignoring an error which would not be thrown for that code.

Includes tidying up the format of the ignore annotation:
* Customary one space between the `//` and the start of the comment.
* There should be no spaces in the comma-separated sniff list.

Follow-up to [45607], [47185], [49200], [53152].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56250 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-28 00:04:24 +00:00
hellofromTonya
565c2179ff Editor: Remove 'wp-edit-site' stylesheet enqueue from iframe.
Removes enqueuing the `'wp-edit-site'` stylesheet from the iframed assets in `_wp_get_iframed_editor_assets()`.

The global `$pagenow` is also removed as it is no longer used within the function.

References:
* [https://github.com/WordPress/gutenberg/pull/54254 Gutenberg PR 54254]

Props ellatrix, jorgefilipecosta, Mamaduka, mukesh27.

Follow-up to [56047], [53160].
Fixes #59456.
Built from https://develop.svn.wordpress.org/trunk@56736


git-svn-id: http://core.svn.wordpress.org/trunk@56248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 17:40:20 +00:00
costdev
872ad9e0b8 Filesystem API: Free the archive in _unzip_file_ziparchive().
There are several early returns in `_unzip_file_ziparchive()` which don't close the archive prior to returning.

As this function is used in installation and upgrade processes which are memory-intensive, this calls `ZipArchive::close()` to free the archive prior to each early return. This excludes the first return which is a result of a failure to open the archive, which is [https://github.com/nih-at/libzip/blob/main/lib/zip_open.c#L62-L73 freed internally] when the failure occurs.

References:
- PHP.net: [https://www.php.net/manual/en/ziparchive.open.php ZipArchive::open()] and [https://www.php.net/manual/en/ziparchive.close.php ZipArchive::close()]
- libzip: [https://libzip.org/documentation/zip_open.html zip_open()] and [https://libzip.org/documentation/zip_close.html zip_close()]

Follow-up to: [13005], [13006], [13015], [13221], [14346] [25779].

Props azaozz, afragen, joemcgill, costdev.
Fixes #59467
Built from https://develop.svn.wordpress.org/trunk@56735


git-svn-id: http://core.svn.wordpress.org/trunk@56247 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 16:31:19 +00:00
hellofromTonya
856e2fcfb1 Text Changes: Remove empty space in Erase Personal Data help tab.
Improves the text by removing an empty space at the end of a string within the "Default Data" help tab of the "Erase Personal Data".

Props azharckra, kebbet, krupalpanchal, mukesh27.

Follow-up to [53182].
Fixes #59473.
Built from https://develop.svn.wordpress.org/trunk@56734


git-svn-id: http://core.svn.wordpress.org/trunk@56246 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 15:44:24 +00:00
Bernhard Reiter
06be2cac58 Blocks: Add unit test coverage for Patterns registry.
Prior to this changeset, we did not seem to have any unit test coverage for the Patterns registry (`WP_Block_Patterns_Registry`).

With Block Hooks logic recently added ([56649]), it is particularly advisable to add some unit tests to the `get_registered()` and `get_all_registered()` methods to guard hooked block insertion against regressions.

Fixes #59476.
Built from https://develop.svn.wordpress.org/trunk@56733


git-svn-id: http://core.svn.wordpress.org/trunk@56245 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 13:10:23 +00:00
Sergey Biryukov
b2c997556a Bootstrap/Load: Remove a redundant continue statement in add_magic_quotes().
Follow-up to [48205], [48440].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 09:42:24 +00:00
isabel_brison
8f422594ee Editor: fix undefined array key warning.
Checks if `attrs` array key exists before using its value.

Props mukesh27, kafleg.
Fixes #59468.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56243 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-27 05:12:22 +00:00
Tammie Lister
6ba0e95c88 Post WordPress 6.4 Beta 1 version bump.
Built from https://develop.svn.wordpress.org/trunk@56730


git-svn-id: http://core.svn.wordpress.org/trunk@56242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 20:18:23 +00:00
Tammie Lister
5fee993b2e WordPress 6.4 Beta 1.
Built from https://develop.svn.wordpress.org/trunk@56729


git-svn-id: http://core.svn.wordpress.org/trunk@56241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 19:54:21 +00:00
hellofromTonya
d02e84860f Editor: 2nd package updates for 6.4 Beta 1.
Round 2 of package updates for 6.4. Beta 1 which includes disabling the rendering of the Font Library in Core.

The full list of changes are found here 641b696cd6.

Follow-up to [56710], [56713].

Props mikachan, mmaattiiaass, mamaduka, desrosj, ockham, hellofromTonya.
See #59411.
Built from https://develop.svn.wordpress.org/trunk@56728


git-svn-id: http://core.svn.wordpress.org/trunk@56240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 19:11:22 +00:00
Tammie Lister
7df8ec6846 Bundled Themes: Twenty Twenty-Four is now the default theme.
Follow up to [56716].
Props desrosj.

See #59447.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 17:33:20 +00:00
desrosj
e814c09465 Twenty Twenty-Four: Fix issue with theme screenshot.
Follow up to [56716] and [56725].

Props karmatosed.
Fixes #59447.
Built from https://develop.svn.wordpress.org/trunk@56726


git-svn-id: http://core.svn.wordpress.org/trunk@56238 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 17:15:22 +00:00
desrosj
dd0700e374 General: Define the desired mime-type for WebP files.
Fixes #59463.
Built from https://develop.svn.wordpress.org/trunk@56725


git-svn-id: http://core.svn.wordpress.org/trunk@56237 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 17:07:22 +00:00
Bernhard Reiter
dfd85ad690 Templates: Introduce _remove_theme_attribute_from_template_part_block.
Introduce a `_remove_theme_attribute_from_template_part_block()` function that can be used as a callback argument for `traverse_and_serialize_block(s)` on a parsed block tree in order to remove the `theme` attribute from all Template Part blocks found therein, and deprecate `_remove_theme_attribute_in_block_template_content()`.

Counterpart to `_inject_theme_attribute_in_template_part_block` from #59338 (which superseded `_inject_theme_attribute_in_block_template_content`, deprecated in #59452).

Props mukesh27.
Fixes #59460.
Built from https://develop.svn.wordpress.org/trunk@56724


git-svn-id: http://core.svn.wordpress.org/trunk@56236 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 17:01:24 +00:00
Sergey Biryukov
2c11f49301 HTTP API: Deprecate the http_api_transports filter.
The filter is only used within the `WP_Http::_get_first_available_transport()` method, which has been marked as deprecated in favor of `\WpOrg\Requests\Requests::get_transport_class()`.

Follow-up to [56655]

Props desrosj, hellofromTonya.
Fixes #58705.
Built from https://develop.svn.wordpress.org/trunk@56723


git-svn-id: http://core.svn.wordpress.org/trunk@56235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:55:20 +00:00
Bernhard Reiter
c44e5163b6 Templates: Move old theme attr injection function to deprecated.php.
Move the now-deprecated function `_inject_theme_attribute_in_block_template_content` from `wp-includes/block-template-utils.php` to `wp-includes/deprecated.php`.

Follow-up [56719].
Props spacedmonkey, davidbaumwald, mukesh27.
See #59452.
Built from https://develop.svn.wordpress.org/trunk@56722


git-svn-id: http://core.svn.wordpress.org/trunk@56234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:49:21 +00:00
desrosj
0543b6216a Twenty Twenty-Four: Fix font and image assets.
This updates the font and image files to include the correct file contents.

Follow up to [56716].

Props onemaggie, karmatosed.
See #59447.
Built from https://develop.svn.wordpress.org/trunk@56721


git-svn-id: http://core.svn.wordpress.org/trunk@56233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:46:22 +00:00
costdev
a27059766b Toolbar: Link to Learn WordPress in the WordPress Logo menu.
This aims to make the various resources on learn.wordpress.org more easily available.

Props jeherve, mikinc860, audrasjb, sabernhardt, courane01, devmuhib, dhrumilk, estelaris, hellofromTonya.
Fixes #58820.
Built from https://develop.svn.wordpress.org/trunk@56720


git-svn-id: http://core.svn.wordpress.org/trunk@56232 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:29:20 +00:00
Bernhard Reiter
70e906c26e Templates: Deprecate _inject_theme_attribute_in_block_template_content.
It can be replaced by passing `_inject_theme_attribute_in_template_part_block` as second argument to `traverse_and_serialize_blocks()`.

Per WordPress 6.4 Beta 1, there aren't going to be any more calls in Core to `_inject_theme_attribute_in_block_template_content()`.

Note that `_inject_theme_attribute_in_block_template_content` has always had `@access private` set in its PHPDoc.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:19:21 +00:00
Sergey Biryukov
57f2930594 Login and Registration: Add /login.php as an alias for the login page.
This aims to make the login process more user-friendly.

Follow-up to [19875], [19880].

Props lancewillett, subrataemfluence, tejwanihemant, ankit-k-gupta, devmuhib, audrasjb, hellofromTonya, joemcgill.
Fixes #40762.
Built from https://develop.svn.wordpress.org/trunk@56718


git-svn-id: http://core.svn.wordpress.org/trunk@56230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 16:11:20 +00:00
Felix Arntz
7e1caa5b44 Options, Meta APIs: Fix follow up bug when comparing values for options using the pre_option_{$option} filter.
This fix is relevant for options such as `gmt_offset` that use a filter to force a specific value regardless of what is stored in the database.

Props mamaduka, flixos90, mukesh27, spacedmonkey.
See #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56229 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:55:18 +00:00
Tammie Lister
7b9c4a9dfe Bundled Themes: Import Twenty Twenty-Four, the new default theme for WordPress 6.4.
Twenty Twenty-Four is designed to be flexible, versatile and applicable to any website. Its collection of templates and patterns tailor to different needs, such as presenting a business, blogging and writing or showcasing work. A multitude of possibilities open up with just a few adjustments to color and typography.

Twenty Twenty-Four comes with style variations and full page designs to help speed up the site building process, is fully compatible with the site editor, and takes advantage of new design tools introduced in WordPress 6.4. 

Twenty-Four karat magic in the air!

Props onemaggie, luminuu, beafialho, chrisdesrochers, amedv, melchoyce, kafleg, jeffikus, poena, robpetrin, hiyascout, audrasjb, huzaifaalmesbah, fabiankaegy, jordesign, vcanales, shailu25, jessplease, juanfra, maneshtimilsina, sabernhardt, richtabor, travel_girl, kishanjasani, sofiashendi, nudge, gnanasekaran, marcelle42, bosskhj, oncecoupled, bijayyadav, barbmiller, devmuhib, lyndauwp, kraftbj, alaminfirdows, littlebigthing, dhamibirendra, jeffpaul, kopila47, rabmalin, aplauche, colorful-tones, khleomix, pbking, esratpopy, scruffian, alexandrebuffet, gpotter, pbwebd, anphira, suprsam, damonsharp, maurodf, soean, kawsaralameven, mhimon, rajinsharwar, labunchemjong, bonkerz, karmacharya50, aristath, mukesh27, mikachan, joedolson, aurooba, afercia, jffng, benimub, joen, tanvirul, jeryj, thelovekesh, mrwweb, nielslange, sergiomdgomes, binsaifullah, hanneslsm, masoudnkh, dhrumilk, dianeco, webmandesign, desrosj.
See #59447.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:50:23 +00:00
Adam Silverstein
3092085a60 Revisions: avoid double call to wp_restore_post_revision_meta when restoring post.
Remove an extra call to `wp_restore_post_revision_meta` - the meta restore action is already hooked to `wp_restore_post_revision`.

Follow up to [56714].

Props: spacedmonkey.
Fixes #20564.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56227 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:44:19 +00:00
Adam Silverstein
89a99dba2f Revisions: framework for storing post meta revisions.
Enable the storing of post meta in revisions including autosaves and previews:

Add a new argument `revisions_enabled` to the `register_meta` function which enables storing meta in revisions.

Add a new `wp_post_revision_meta_keys` filter which developers can use to control which meta is revisioned - it passes an array of the meta keys with revisions enabled as well as the post type.

Meta keys with revisions enabled are also stored for autosaves, and are restored when a revision or autosave is restored. In addition, meta values are now stored with the autosave revision used for previews. Changes to meta can now be previewed correctly without overwriting the published meta (see #20299) or passing data as a query variable, as the editor currently does to preview changes to the featured image.

Changes to meta with revisions enabled are considered when determining if a new revision should be created. A new revision is created if the meta value has changed since the last revision.

Revisions are now saved on the `wp_after_insert_post` hook instead of `post_updated`. The `wp_after_insert_post` action is fired after post meta has been saved by the REST API which enables attaching meta to the revision. To ensure backwards compatibility with existing action uses, `wp_save_post_revision_on_insert` function exits early if plugins have removed the previous `do_action( 'post_updated', 'wp_save_post_revision' )` call.

Props: alexkingorg, johnbillion, markjaquith, WraithKenny, kovshenin, azaozz, tv-productions, p51labs, mattheu, mikeschroder, Mamaduka, ellatrix, timothyblynjacobs, jakemgold, bookwyrm, ryanduff, mintindeed, wonderboymusic, sanchothefat, westonruter, spacedmonkey, hellofromTonya, drewapicture, adamsilverstein, swisspiddy.
Fixes #20564, #20299.



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


git-svn-id: http://core.svn.wordpress.org/trunk@56226 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:32:19 +00:00
Tammie Lister
36f1df7246 Update regenerated build files.
This adds in missed generated build files from commit for [56710].

Props desrosj.
See #59411.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56225 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:27:22 +00:00
costdev
61cef87240 Quick/Bulk Edit: Pre-fill category fields with their status.
This pre-fills category fields in the Quick/Bulk Edit form with their current status.

When bulk editing, if only some of the selected items are in a given category, the category's checkbox will display a line to indicate an indeterminate status.

Props pavelevap, scribu, chasedsiedu, helen, joshcanhelp, ubernaut, Cyberchicken, laumindproductscomau, SergeyBiryukov, Marcoevich, tomybyte, thinkluke, virtality-marketing-solutions, Michalooki, dmsnell, itecrs, pannelars, WHSajid, samba45, Mte90, johnbillion, tomluckies, soulseekah, francina, oglekler, ajmcfadyen, mukesh27, costdev.
Fixes #11302.
Built from https://develop.svn.wordpress.org/trunk@56712


git-svn-id: http://core.svn.wordpress.org/trunk@56224 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 15:05:21 +00:00
hellofromTonya
61003dc0e7 Media: Change link text when attachment pages disabled.
When attachment pages are disabled, change the links from "View Attachment Page" to "View Media File".

Follow-up to [56657], [56658].

Props joedolson, ironprogrammer, oglekler.
Fixes #57913.
Built from https://develop.svn.wordpress.org/trunk@56711


git-svn-id: http://core.svn.wordpress.org/trunk@56223 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 14:45:23 +00:00
Tammie Lister
04f631f232 Update editor related npm packages
The npm packages needed updating for 6.4 to the latest.

Props mikachan, mukesdpanchal27, luisherranz, youknowriad, tellthemachines, gziolo, ockham, michalczaplinski

Fixes #59411


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


git-svn-id: http://core.svn.wordpress.org/trunk@56222 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 14:23:26 +00:00
Sergey Biryukov
9bf6faff7c Editor: Reduce the use of the _wp_array_get() function to improve performance.
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376, it is still called more times than it should be.

This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.

Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116 #51116 Performance improvement: Reduce the use of the _wp_array_get() function]

Follow-up to [55851], [56382].

Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes #59405.
Built from https://develop.svn.wordpress.org/trunk@56709


git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 13:47:20 +00:00
Pascal Birchler
72460848c9 Sitemaps: do not list users who only authored pages.
Author archives are only generated for users who created at least one post.
Prevent adding author archives to the XML sitemap for users who only authored pages
as the links would otherwise result in a 404.

Props zodiac1978, huzaifaalmesbah.
Fixes #57816.
Built from https://develop.svn.wordpress.org/trunk@56708


git-svn-id: http://core.svn.wordpress.org/trunk@56220 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 12:42:19 +00:00
hellofromTonya
534f200e48 General: Use wp_kses() in wp_trigger_error().
Uses `wp_kses()` instead of `esc_html()` to allow a list of HTML tags and protocols in the message rather than escaping them.

Why? To retain message readability in the browser and server logs, especially given that Core itself adds HTML to messages in functions, e.g. `_doing_it_wrong()` and each of the `_deprecated_*()` functions. 

HTML tags allowed:
* `a href`
* `br`
* `code`
* `em`
* `strong`

Protocols allowed: `http` and `https`.

To inform extenders, it also documents that any other HTML tags or protocols need to be escaped before passing the message to this function to avoid them being stripped from the message.

Follow-up to [56530], [56705].

Props azaozz, costdev, flixos90, hellofromTonya, peterwilsoncc.
Fixes #57686.
Built from https://develop.svn.wordpress.org/trunk@56707


git-svn-id: http://core.svn.wordpress.org/trunk@56219 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 12:38:19 +00:00
spacedmonkey
d969240845 Editor: Fix deprecation notice in block editor.
In [56682], the `print_emoji_styles` function was deprecated and a corresponding deprecation notice was added. In order to maintain backward compatibility, `print_emoji_styles` was retained as a hook into wp_print_styles. This resulted in the appearance of deprecation notices within the block editor. The root of this issue was the manual invocation of the `wp_print_styles` function in block-editor.php. To address this, the `print_emoji_styles` callback was manually removed, `wp_print_styles` was called, and the action was subsequently rehooked, resolving the deprecation notice within the block editor. 

Props mamaduka, hellofromtonya, spacedmonkey.
See #58775.
Built from https://develop.svn.wordpress.org/trunk@56706


git-svn-id: http://core.svn.wordpress.org/trunk@56218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 12:28:22 +00:00
hellofromTonya
c8aea02b38 General: Use wp_trigger_error() in _doing_it_wrong() and _deprecated_*().
Uses `wp_trigger_error()` in `_doing_it_wrong()` and each `_deprecated_*()` function, i.e. instead of `trigger_error()`.

To avoid redundancy, uses `wp_trigger_error()` once. How? Saves each message to `$message` variable and then passes it to `wp_trigger_error()` at the end of the function.

Functions:
* _doing_it_wrong()
* _deprecated_function()
* _deprecated_constructor()
* _deprecated_class()
* _deprecated_file()
* _deprecated_argument()
* _deprecated_hook()

Follow-up to [56530].

Props azaozz, costdev, flixos90, hellofromTonya, peterwilsoncc.
See #57686.
Built from https://develop.svn.wordpress.org/trunk@56705


git-svn-id: http://core.svn.wordpress.org/trunk@56217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 11:51:19 +00:00
Bernhard Reiter
eeefd48208 Blocks: Have get_hooked_blocks() return blocks grouped by position.
All existing calls of `get_hooked_blocks()` in non-test code are currently wrapped in an extra `array_keys()` call. This changeset absorbs that logic into the function and changes the structure of the return value accordingly.

Furthermore, this allows us to remove the extra `$relative_position` argument (introduced in [56673]) from the function again, as the same data can now be simply fetched via array access.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 11:49:21 +00:00
Bernhard Reiter
2d9b5cb098 HTML API: Add class name utilities has_class() and class_list().
This patch adds two new public methods to the HTML Tag Processor:
 - `has_class()` indicates if a matched tag contains a given CSS class name.
 - `class_list()` returns a generator to iterate over all the class names in a matched tag.

Included in this patch is a refactoring of the internal logic when matching
a tag to reuse the new `has_class()` function. Previously it was relying on
optimized code in the `matches()` function which performed byte-for-byte
class name comparison. With the change in this patch it will perform class
name matching on the decoded value, which might differ if a class attribute
contains character references.

These methods may be useful for running more complicated queries based
on the presence or absence of CSS class names. The use of these methods
avoids the need to manually decode the class attribute as reported by
`$process->get_attribute( 'class' )`.

Props dmsnell.
Fixes #59209.
Built from https://develop.svn.wordpress.org/trunk@56703


git-svn-id: http://core.svn.wordpress.org/trunk@56215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 09:17:18 +00:00
Bernhard Reiter
374bcd9b3d HTML API: Add matches_breadcrumbs() method for better querying.
Inside a `next_tag()` loop it can be challenging to use breadcrumbs because they are only exposed inside the call to `next_tag()` via the `$query` arg.

In this patch a new method, `matches_breadcrumbs()`, is exposed which allows for querying within the `next_tag()` loop for more complicated queries.

This method exposes a wildcard `*` operator to allow matching ''any HTML tag'' that the currently-matched tag is a child or descendant of.

Props dmsnell, westonruter, mukesh27.
Fixes #59400.
Built from https://develop.svn.wordpress.org/trunk@56702


git-svn-id: http://core.svn.wordpress.org/trunk@56214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 08:20:17 +00:00
gziolo
2481f2de2b Blocks: Add more unit test covering edge cases for Block Hooks
These two new unit tests document how Block Hooks behave with `first_child` and `last_child` relative positions. The hooked blocks will only get inserted in the case where the parent block has at least one child block present. While it seems like a limitation, in practice, it's hard to think of a case where the template would use a parent block without its children. It's more likely to happen with patterns in general, but in the case of patterns wired with the block theme, it also seems unlikely. The reasoning here is that out of the box, the block theme should produce a fully functional and valid HTML.

Props ockham.
See #59313.
Follow-up [56649].


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


git-svn-id: http://core.svn.wordpress.org/trunk@56213 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 08:09:16 +00:00
isabel_brison
5ce36ff8f5 Editor: remove null coalescing operator from layout.
Replaces uses of null coalescing operator in [56698].

Props dmsnell, mukesh27.
See #59443.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56212 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 06:55:12 +00:00
gziolo
bab9c206eb Build: Introduce SCRIPT_DEBUG global in webpack processing
Backports the same changes to the webpack config in the Gutenberg plugin with https://github.com/WordPress/gutenberg/pull/50122.

The `warning` function from `@wordpress/warning` no longer worked correctly with webpack 5. In practice, it no longer called `console.warn`. To fix it, the usage of `process.env.NODE_ENV` check got replaced with another optional global: `SCRIPT_DEBUG`. All the tools used in the Gutenberg, get updated to work with this new constant, including `@wordpress/scripts`. This way, developers are able to guard code that should be run only in development mode. In WordPress core, the same constant needs to be added mostly to ensure that the code behind the check gets completely removed in production mode.

Fixes #59407.


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


git-svn-id: http://core.svn.wordpress.org/trunk@56211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 06:51:19 +00:00
isabel_brison
3317a134af Editor: make better use of Tag Processor in layout block support.
Refactors layout support to use a single Tag Processor instance and send one class at a time to `add_class()`.

Props dmsnell, hellofromTonya.
Fixes #59443.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 05:04:22 +00:00
Peter Wilson
109f531fbf Administration: Add event type to Events and News widget.
Add the event type (WordCamp, Meetup, etc) to the nearby events listing within the Dashboard's Events and News widget.

Props renyot, audrasjb, ankit-k-gupta, oglekler, devmuhib, dhruvishah2203, JeffPaul, anveshika, sarahwilliams889, ajakaroth.
Fixes #58947.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 03:54:20 +00:00
Sergey Biryukov
7fd4a45fca Build/Test Tools: Use the latest PHP version for the coding standards workflow.
PHPCS can now be run on the latest PHP version as all known PHP 8.x compatibility issues (in WPCS) have been fixed.

Follow-up to [49162], [56695].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:48:18 +00:00
Sergey Biryukov
114a672cfa Coding Standards: Upgrade WPCS to version 3.0.0.
This is an important release which makes significant changes to improve the accuracy, performance, stability and maintainability of all sniffs, as well as making WordPressCS much better at handling modern PHP.

WordPressCS 3.0.0 contains breaking changes, both for people using ignore annotations, people maintaining custom rulesets, as well as for sniff developers who maintain a custom PHPCS standard based on WordPressCS.

If you are an end-user or maintain a custom WordPressCS based ruleset, please start by reading the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-ruleset-maintainers Upgrade Guide to WordPressCS 3.0.0 for ruleset maintainers] which lists the most important changes and contains a step by step guide for upgrading.

If you are a maintainer of an external standard based on WordPressCS and any of your custom sniffs are based on or extend WordPressCS sniffs, please read the [https://github.com/WordPress/WordPress-Coding-Standards/wiki/Upgrade-Guide-to-WordPressCS-3.0.0-for-Developers-of-external-standards Upgrade Guide to WordPressCS 3.0.0 for Developers].

In all cases, please read the complete changelog carefully before you upgrade.

This commit:
* Updates the Composer dependencies to use the new version, including updating the underlying PHP_CodeSniffer dependency to the new minimum supported version for WPCS.[[BR]] Note: the Composer PHPCS installer plugin is no longer explicitly required as it is now a dependency of WPCS, so the dependency is inherited automatically.
* Updates the ruleset for WPCS 3.0.0. This includes:
 * Raising the memory limit to be on the safe side as WPCS 3.0.0 contains a lot more sniffs.
 * Removing explicit inclusions of extra rules, which have now been added to the `WordPress-Core` ruleset..
 * Updating property names for select sniffs.
 * Updating one exclusion — the `WordPress.CodeAnalysis.AssignmentInCondition` sniff has been (partially) replaced by the `Generic.CodeAnalysis.AssignmentInCondition` sniff.
 * Adding one new exclusion.
* Downgrades one new error to a warning.[[BR]] The `Generic.Files.OneObjectStructurePerFile` sniff enforces that there is only one OO structure declaration per file. At this time, this sniff would yield 29 errors. By downgrading the sniff to a ''warning'', the build can pass and the issues can be fixed in due time. For now, the test directory will be excluded until the issues are fixed (as the test directory CS run does not allow for warnings).
* Updates ignore annotations for WPCS 3.0.0.

Reference: [https://github.com/WordPress/WordPress-Coding-Standards/releases/tag/3.0.0 WPCS 3.0.0 release notes].

Follow-up to [43571], [44574], [45600], [47927].

Props jrf, jorbin, desrosj.
See #59161.
Built from https://develop.svn.wordpress.org/trunk@56695


git-svn-id: http://core.svn.wordpress.org/trunk@56207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:27:12 +00:00
Sergey Biryukov
46b0f1bba1 Code Modernization: Rename parameters that use reserved keywords in phpunit/tests/media.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the `$match` parameter to `$matches` in shortcode image tests.

Note: This is enforced by WPCS 3.0.0.

Follow-up to [56693].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56206 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:25:17 +00:00
Felix Arntz
70e0a22e7d Media: Ensure images within shortcodes are correctly considered for loading optimization attributes.
Prior to this change, images added in shortcodes would be considered separately from all other images within post content, which led to incorrect application of the loading optimization attributes `loading="lazy"` and `fetchpriority="high"`.

This changeset changes the filter priority of `wp_filter_content_tags()` from the default `10` to `12` on the various content filters it is hooked in, in order to run that function after parsing shortcodes. While this may technically be considered a backward compatibility break, substantial research and lack of any relevant usage led to the assessment that the change is acceptable given its benefits.

An additional related fix included is that now the duplicate processing of images is prevented not only for post content blobs (`the_content` filter), but also for widget content blobs (`widget_text_content` and `widget_block_content` filters).

Props joemcgill, mukesh27, costdev, spacedmonkey, flixos90.
Fixes #58853.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56205 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:13:12 +00:00
Sergey Biryukov
5d91b75895 Coding Standards: Fix a few newly introduced WPCS issues.
Follow-up to [56683], [56689].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-26 00:09:19 +00:00
costdev
1c79a2c23b Filesystem API: Add missing ZIP file for unzip tests.
In [56689], a ZIP file is needed in `tests/phpunit/data/filesystem/` but wasn't included in the changeset. This produced an error when attempting to create a subdirectory during the tests.

This adds the `tests/phpunit/data/filesystem/archive.zip` file.

Follow-up to [56689].

Props flixos90.
Fixes #37719.
Built from https://develop.svn.wordpress.org/trunk@56691


git-svn-id: http://core.svn.wordpress.org/trunk@56203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 23:40:17 +00:00
Felix Arntz
8964275967 Media: Rely on wp_get_loading_optimization_attributes() to add decoding="async" to images.
The `wp_get_loading_optimization_attributes()` function was introduced in 6.3, as a single centralized place to control loading optimization attributes for various tags, most importantly images.

This changeset consolidates the `decoding="async"` optimization, which was added in 6.1, to occur solely as part of `wp_get_loading_optimization_attributes()`, removing duplicate code and allowing centralized filtering based on [56651].

As part of the change, the `wp_img_tag_add_decoding_attr()` function has been deprecated. The filter of the same name continues to be maintained for backward compatibility, as before covering only images that are part of a content blob such as post content (`the_content`).

Props pereirinha, mukesh27, joemcgill, flixos90.
Fixes #58892.
See #53232.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56202 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 22:38:17 +00:00
costdev
36e754b5c3 Filesystem API: Introduce filters for before/after unzipping archives.
This introduces the following new filters which wrap the process of unzipping an archive:
- `pre_unzip_file` - Filters archive unzipping to allow an override with a custom process.
- `unzip_file` - Filters the result of unzipping an archive.

Both filters pass the following:
- `string $file` - Full path and filename of ZIP archive.
- `string $to` - Full path on the filesystem to extract archive to.
- `string[] $needed_dirs` - A full list of required folders that need to be created.
- `float|false $required_space` - The space required to unzip the file and copy its contents, with a 10% buffer.

Props dfavor, azaozz, oglekler, afragen, costdev.
Fixes #37719.
Built from https://develop.svn.wordpress.org/trunk@56689


git-svn-id: http://core.svn.wordpress.org/trunk@56201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 22:16:17 +00:00
hellofromTonya
9122ef68e1 Fonts: Get font-family name from 'fontFamily' field.
Instead of getting the name from the optional `'name'` field, the font-family name now comes from the required `'fontFamily'` field.

This change fixes a back-compat (BC) break in how the font-family name is pulled from the incoming font data in the `WP_Font_Face_Resolver`.

Why?

WP Core does not require the `'name'` field in theme.json. For themes that do not declare it, that set of font variations is ignored, thus causing a BC break from how the stopgap code worked (see [53282]).

However, `WP_Theme_JSON` schema does require the `fontFamily` field in each of the `typography.fontFamilies`.

== Other details:

Includes a parser to extract the first entry when a `fontFamily` field has a comma-separated list of font-families, e.g. `Inter, sans-serif`.

References:
* Merge from Gutenberg's PR https://github.com/WordPress/gutenberg/pull/54615.

Follow-up to [56500], [53282].

Props ironprogrammer, hellofromTonya, mmaattiiaass, pbking.
Fixes #59165.
Built from https://develop.svn.wordpress.org/trunk@56688


git-svn-id: http://core.svn.wordpress.org/trunk@56200 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 21:29:17 +00:00
Weston Ruter
e7747ce23e Script Loader: Use wp_get_script_tag() and wp_get_inline_script_tag()/wp_print_inline_script_tag() helper functions to output scripts on the frontend and login screen.
Using script tag helper functions allows plugins to employ the `wp_script_attributes` and `wp_inline_script_attributes` filters to inject the `nonce` attribute to apply Content Security Policy (e.g. Strict CSP). Use of helper functions also simplifies logic in `WP_Scripts`.

* Update `wp_get_inline_script_tag()` to wrap inline script in CDATA blocks for XHTML-compatibility when not using HTML5.
* Ensure the `type` attribute is printed first in `wp_get_inline_script_tag()` for back-compat.
* Wrap existing `<script>` tags in output buffering to retain IDE supports.
* In `wp_get_inline_script_tag()`, append the newline to `$javascript` before it is passed into the `wp_inline_script_attributes` filter so that the CSP hash can be computed properly.
* In `the_block_template_skip_link()`, opt to enqueue the inline script rather than print it.
* Add `ext-php` to `composer.json` under `suggest` as previously it was an undeclared dependency for running PHPUnit tests.
* Update tests to rely on `DOMDocument` to compare script markup, normalizing unsemantic differences.

Props westonruter, spacedmonkey, flixos90, 10upsimon, dmsnell, mukesh27, joemcgill, swissspidy, azaozz.
Fixes #58664.
See #39941.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 21:05:21 +00:00
desrosj
98a0a6b5e5 Docs: Revert [56679].
`Memoizes` is actually correct in this context.

Unprops desrosj.
See #18298.
Built from https://develop.svn.wordpress.org/trunk@56686


git-svn-id: http://core.svn.wordpress.org/trunk@56198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 20:49:18 +00:00
Bernhard Reiter
061c32d574 HTML API: Remove all duplicate copies of an attribute when removing.
When encountering an HTML tag with duplicate copies of an attribute the tag processor ignores the duplicate values, according to the specification. However, when removing an attribute it must remove all copies of that attribute lest one of the duplicates becomes the primary and it appears as if no attributes were removed.

In this patch we're adding tests that will be used to ensure that all attribute copies are removed from a tag when one is request to be removed.

**Before**

{{{#!php
<?php
$p = new WP_HTML_Tag_Processor( '<br id=one id="two" id='three' id>' );
$p->next_tag();
$p->remove_attribute( 'id' );
$p->get_updated_html();
// <br id="two" id='three' id>
}}}

**After**

{{{#!php
<?php
$p = new WP_HTML_Tag_Processor( '<br id=one id="two" id='three' id>' );
$p->next_tag();
$p->remove_attribute( 'id' );
$p->get_updated_html();
// <br>
}}}

Previously we have been overlooking duplicate attributes since they don't have an impact on what parses into the DOM. However, as one unit test affirmed (asserting the presence of the bug in the tag processor) when removing an attribute where duplicates exist this meant we ended up changing the value of an attribute instead of removing it.

In this patch we're tracking the text spans of the parsed duplicate attributes so that ''if'' we attempt to remove them then we'll have the appropriate information necessary to do so. When an attribute isn't removed we'll simply forget about the tracked duplicates. This involves some overhead for normal operation ''when'' in fact there are duplicate attributes on a tag, but that overhead is minimal in the form of integer pairs of indices for each duplicated attribute.

Props dmsnell, zieladam.
Fixes #58119.
Built from https://develop.svn.wordpress.org/trunk@56684


git-svn-id: http://core.svn.wordpress.org/trunk@56196 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 19:04:19 +00:00
spacedmonkey
66c782f6cd Editor: Introduce get_block_asset_url Utility Function.
This commit introduces a valuable utility function, get_block_asset_url, designed to simplify the retrieval of block asset URLs, such as those for CSS and JavaScript files. This utility eliminates redundancy in both register_block_script_handle and register_block_style_handle. Additionally, `get_block_asset_url` incorporates an early exit mechanism to optimize performance.

This update includes comprehensive unit tests, covering various scenarios, including asset registration from core (wp-includes), themes, child themes, plugins, and mu-plugins.

Props spacedmonkey, joemcgill, flixos90, gziolo.
Fixes #58525.
Built from https://develop.svn.wordpress.org/trunk@56683


git-svn-id: http://core.svn.wordpress.org/trunk@56195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 17:49:19 +00:00
spacedmonkey
72f19abd94 Script Loader: Replace hardcoded output of style tags with calls to wp_add_inline_style.
In this commit, enhancements have been made by replacing manually constructed style tags with calls to `wp_add_inline_style`. Previously, numerous style tags were generated and output directly in the header, resulting in redundant code and bypassing the core's style enqueueing system. This approach made it challenging for third-party developers to manage and control the output of these style tags.

To ensure backward compatibility, the following functions have been deprecated and replaced:

- print_embed_styles
- print_emoji_styles
- wp_admin_bar_header
- _admin_bar_bump_cb

Backward compatibility shims have also been added, ensuring that if these functions were previously unhooked from there actions, they will continue to not output a style tag.

However, for the following functions, conversion to use inline styles was not feasible due to the potential disruption it might cause by changing the style tag IDs, potentially breaking JavaScript functionality for a number of plugins in the repository:

- custom-background
- wp-custom

These changes improve code maintainability and enhance the flexibility and control available to developers when managing style outputs within WordPress core.

Props spacedmonkey, hlunter, westonruter, flixos90.
Fixes #58775.
Built from https://develop.svn.wordpress.org/trunk@56682


git-svn-id: http://core.svn.wordpress.org/trunk@56194 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 17:06:34 +00:00
Felix Arntz
bfbcb02444 Options, Meta APIs: Improve logic to avoid unnecessary database writes in update_option().
Prior to this change, a strict comparison between the old and new database value could lead to a false negative, since database values are generally stored as strings. For example, passing an integer to `update_option()` would almost always result in an update given any existing database value for that option would be that number cast to a string.

This changeset adjusts the logic to perform an intentional "loose-y" comparison by casting the values to strings. Extensive coverage previously added in [56648] provides additional confidence that this does not introduce any backward compatibility issues.

Props mukesh27, costdev, spacedmonkey, joemcgill, flixos90, nacin, atimmer, duck_, boonebgorges.
Fixes #22192.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56193 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 16:25:19 +00:00
Sergey Biryukov
28af9eafb0 Coding Standards: Fix a few newly introduced WPCS issues.
Follow-up to [56570], [56573], [56589], [56604], [56612], [56620], [56629], [56631], [56638], [56642], [56644], [56649].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56192 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 15:36:18 +00:00
desrosj
d9f4318a56 Docs: Correct typo in new @since tag.
Follow up to [56635], [56641].

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


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

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


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

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


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

Props spacedmonkey, ockham.
See #59346.


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


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

Fixes #59229.

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


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

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


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

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

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


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

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


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

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


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

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


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

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

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


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

This fixes the spelling error.

Follow-up to [56587].

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


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

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

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

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


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

No functional changes.

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


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

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


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

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

Props audrasjb, johnbillion, Michi91.
Fixes #58494.


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


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

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


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

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


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

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

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

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

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


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

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

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


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

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

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

Follow up to [56647].

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


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

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


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

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

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

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

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


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

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


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

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

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

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


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

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


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

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


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

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


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

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

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


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

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

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

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

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


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

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

The two core tenets for Block Hooks are:

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

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

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

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

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

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


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

Props joemcgill.
See #22192.

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


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

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

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


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

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

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


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

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

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


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

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

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


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

Props czapla, costdev, desrosj.
Fixes #59393.

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


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

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

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


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

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

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

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


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

Props ramonopoly, audrasjb, costdev.
Fixes #59401.

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


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

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


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

Fixes #59370.
Props westonruter, flixos90.

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


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

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


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

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


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

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

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

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

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

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


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

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


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

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

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

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

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


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




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


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

Props thelovekesh, jrf.
Fixes #59336.




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


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

Props ramonopoly.
Fixes #59401.

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


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

Props flixos90, mukesh27.
Fixes #59358.

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


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

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

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


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

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


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

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


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

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

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


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

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

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

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

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

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


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

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

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


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

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

Props ockham, mukesh27.
See #59313.



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


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

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

This changes the reference to `$editor_settings`.

Follow-up to [50776].

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


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

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

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


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

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

Follow-up to [56605].

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


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

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

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

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

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


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

Props aaronrobertshaw, mukesh27.
Fixes  #59359.

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


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

Props andrewserong, mukesh27.
Fixes #59357.

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


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

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

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

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


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

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

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

Props mukesh27, costdev, flixos90.
Fixes #58894.

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


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

This commit introduces two filters for more granular control:

* `quick_edit_enabled_for_post_type`
* `quick_edit_enabled_for_taxonomy`

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

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


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

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

Props ockham.
Fixes #59383.


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


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

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


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

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

Follow-up to [56603].

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


git-svn-id: http://core.svn.wordpress.org/trunk@56120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-18 10:57:16 +00:00