Prevent `WP_List_Table::search_box()` from throwing an array to string conversion notice when post list tables are loaded with an array of orderby parameters in the URL, eg: `/wp-admin/edit.php?post_type=page&orderby[menu_order]=ASC&orderby[title]=ASC`.
Follow up to [29027].
Props leonidasmilossis, rajinsharwar, swissspidy, NomNom99, pls78, SergeyBiryukov.
Fixes#59494.
See #17065.
git-svn-id: https://develop.svn.wordpress.org/trunk@58379 602fd350-edb4-49c9-b593-d223f7449a82
Updates tests calling `get_stylesheet` to not output layout styles if they’re not relevant to the test or to call `get_styles_for_block` instead where more appropriate.
Props isabel_brison, andrewserong, ramonopoly.
Fixes#61371.
git-svn-id: https://develop.svn.wordpress.org/trunk@58378 602fd350-edb4-49c9-b593-d223f7449a82
When the `WP_HTML_Processor` was introduced with its `::create_fragment()`
static creator method, that method has been returning a `new self(...)`.
Unfortunately, this means that subclasses cannot use that method since it
will return the `WP_HTML_Processor` instead of the subclass.
With this patch, the static creator method returns `new static(...)` to preserve
the intended behavior. A new test asserts this behavior for future changes.
Developed in https://github.com/WordPress/wordpress-develop/pull/6729
Discussed in https://core.trac.wordpress.org/ticket/61374
Props dmsnell, jonsurrell.
Follow-up to [56274].
Fixes#61374.
git-svn-id: https://develop.svn.wordpress.org/trunk@58363 602fd350-edb4-49c9-b593-d223f7449a82
Stores the font file sub-directory in the `wp_font_face` post meta. Similar to attachments, only the portion of the path relative to the base directory is stored.
This ensures the files can be deleted alongside their post on sites using a plugin to store font files in sub-directories. Previously running such a plugin would result in the files remaining on the file system post delete.
Props costdev, grantmkin, peterwilsoncc.
Fixes#61297.
git-svn-id: https://develop.svn.wordpress.org/trunk@58353 602fd350-edb4-49c9-b593-d223f7449a82
The `$comment_id` parameter of the `get_comment_author` filter is documented as a numeric string, however in case a non-existing comment ID is passed to the `get_comment_author()` function, it could be an integer instead.
This commit resolves the issue and adds a PHPUnit test demonstrating the behavior.
Includes updating `get_comment_author_url()` unit tests for consistency.
Follow-up to [41127], [52818].
Props david.binda.
Fixes#60475.
git-svn-id: https://develop.svn.wordpress.org/trunk@58335 602fd350-edb4-49c9-b593-d223f7449a82
This caches the generated CSS from block nodes in merged Theme JSON data to avoid repeated costly operations required to compute style properties for blocks. The generated CSS is saved to a transient that expires every hour.
Props thekt12, spacedmonkey, pereirinha, mukesh27, isabel_brison, oandregal, andrewserong, ramonjd.
Fixes#59595.
git-svn-id: https://develop.svn.wordpress.org/trunk@58334 602fd350-edb4-49c9-b593-d223f7449a82
This changeset ensures the `user_activation_key` is flushed after successful login, so reset password links can not be used anymore after the user successfully log into their dashboard.
Props nsinelnikov, rajinsharwar, Rahmohn, oglekler, hellofromTonya.
Fixes#58901.
See #32429
git-svn-id: https://develop.svn.wordpress.org/trunk@58333 602fd350-edb4-49c9-b593-d223f7449a82
This adds a new Site Health check that will alert site owners if they are autoloading a large amount of data from the options table, as it could result in poor performance. The issue will be shown if the size of autoloaded options is greater than 800 KB, which can be adjusted using the new `site_status_autoloaded_options_size_limit` filter.
Props mukesh27, joemcgill, rajinsharwar, costdev, audrasjb, krupajnanda, pooja1210, Ankit K Gupta, johnbillion, oglekler.
Fixes#61276.
git-svn-id: https://develop.svn.wordpress.org/trunk@58332 602fd350-edb4-49c9-b593-d223f7449a82
The Interactivity API has a concept of "derived state" but it only worked on the client (JavaScript). This is the implementation that mirrors it, so derived state has good server-side solution.
Props jonsurrell, darerodz, gziolo, luisherranz, cbravobernal.
Fixes#61037.
git-svn-id: https://develop.svn.wordpress.org/trunk@58327 602fd350-edb4-49c9-b593-d223f7449a82
Aims to improve the developer experience of the Interactivity API server directives processing.
Props cbravobernal, jonsurrell, westonruter, darerodz, czapla, gziolo.
Fixes#61044.
git-svn-id: https://develop.svn.wordpress.org/trunk@58321 602fd350-edb4-49c9-b593-d223f7449a82
Ensures property access in PHP works for object properties or associative array values correctly when processing Interactivity API directives.
Props narenin, cbravobernal, jonsurrell, gziolo, czapla.
Fixes#61039.
git-svn-id: https://develop.svn.wordpress.org/trunk@58320 602fd350-edb4-49c9-b593-d223f7449a82
Checks if `__experimentalSkipSerialization` is set and returns early from `wp_apply_shadow_support` if so.
Props colind, madhudollu, aaronrobertshaw, vcanales, isabel_brison, swissspidy, youknowriad.
Fixes#60784.
git-svn-id: https://develop.svn.wordpress.org/trunk@58312 602fd350-edb4-49c9-b593-d223f7449a82
HTML is a kind of short-hand for a DOM structure. This means that there are
many cases in HTML where an element's opening tag or closing tag is missing (or
both). This is because many of the parsing rules imply creating elements in the
DOM which may not exist in the text of the HTML.
The HTML Processor, being the higher-level counterpart to the Tag Processor, is
already aware of these nodes, but since it's inception has not paused on them
when scanning through a document. Instead, these are visible when pausing on a
child of such an element, but otherwise not seen.
In this patch the HTML Processor starts exposing those implicitly-created nodes,
including opening tags, and closing tags, that aren't foudn in the text content
of the HTML input document.
Previously, the sequence of matched tokens when scanning with
`WP_HTML_Processor::next_token()` would depend on how the HTML document was written,
but with this patch, all semantically equal HTML documents will parse and scan in
the same exact manner, presenting an idealized or "perfect" view of the document
the same way as would occur when traversing a DOM in a browser.
Developed in https://github.com/WordPress/wordpress-develop/pull/6348
Discussed in https://core.trac.wordpress.org/ticket/61348
Props audrasjb, dmsnell, gziolo, jonsurrell.
Fixes#61348.
git-svn-id: https://develop.svn.wordpress.org/trunk@58304 602fd350-edb4-49c9-b593-d223f7449a82
This ensures cached Theme JSON data is cleared between all test classes that extend `WP_Theme_UnitTestCase` and fixes a few tests that would fail in isolation, even though they full test suite would pass.
Props isabel_brison, thekt12, joemcgill.
Fixes#61337.
git-svn-id: https://develop.svn.wordpress.org/trunk@58295 602fd350-edb4-49c9-b593-d223f7449a82
Expand allowable set of custom data attribute names to include those containing
leading, trailing, and double `-` characters. Previously, WordPress was
removing data attributes that are used in the Interactivity API. By allowing
these additional custom data attributes, the related Interactivity API
directives will preserve through `kses`.
For example, the Interactivity API frequently relies on custom data attributes
such as `data-wp-on--click="..."`. The change in [43981] would strip these out
of the processed HTML, however.
Developed in https://github.com/WordPress/wordpress-develop/pull/6598
Discussed in https://core.trac.wordpress.org/ticket/61052
Props cbravobernal, dmsnell, gziolo, jonsurrell.
Follow-up to [43981].
Fixes#61052.
git-svn-id: https://develop.svn.wordpress.org/trunk@58294 602fd350-edb4-49c9-b593-d223f7449a82
As of [57790], the Templates endpoint uses the `rest_pre_insert_*` filter to inject the `ignoredHookedBlocks` metadata attribute into anchor blocks, prior to persisting a template or template part to the database. The same principle was implemented for the Navigation endpoint (where additionally, first and last child blocks added at the top level are store in the `wp_navigation` post object's post meta). The required logic was added to the Navigation block's code, i.e. inside the Gutenberg code repository, and then synchronized to Core.
In order to harmonize the code between the two endpoints, this changeset introduces a new `update_ignored_hooked_blocks_postmeta` function, which is based on the Navigation block's `block_core_navigation_update_ignore_hooked_blocks_meta`, alongside a few helper functions, and hooks it to the `rest_pre_insert_wp_navigation` filter hook. (The Navigation block has been prepared in [58275] to add an additional conditional to check for the new `update_ignored_hooked_blocks_postmeta` filter so there won't be any collisions.)
Eventually, this will allow to deprecate `block_core_navigation_update_ignore_hooked_blocks_meta` (and some related functions), and remove the relevant code from the Navigation block. It also paves the way for some other future changes, such as inserting a hooked block as a Template Part block's first or last child (#60854).
Props tomjcafferkey, bernhard-reiter.
Fixes#60759.
git-svn-id: https://develop.svn.wordpress.org/trunk@58291 602fd350-edb4-49c9-b593-d223f7449a82
Adds handling for a `__default` block binding attribute for pattern overrides that dynamically adds support for all supported block binding attributes.
Props talldanwp, petitphp, mukesh27, isabel_brison, kevin940726.
Fixes#61333.
git-svn-id: https://develop.svn.wordpress.org/trunk@58289 602fd350-edb4-49c9-b593-d223f7449a82
This changeset makes the following changes:
- Adds the title attribute to `<link rel="alternate">` tags for oEmbed and REST API endpoints
- Updates the oEmbed phpunit tests to reflect the above change
- Adds the title link-param to REST API Link: headers (verified as supported in RFC 8288 here: https://httpwg.org/specs/rfc8288.html#serialisation-defined-attributes)
Props edent, kadamwhite, TimothyBlynJacobs, joedolson, swissspidy, sabernhardt.
Fixes#59006.
git-svn-id: https://develop.svn.wordpress.org/trunk@58286 602fd350-edb4-49c9-b593-d223f7449a82
Developers can now include /wp/v2/users routes when making a batch API request.
Props alexminza, timothyblynjacobs, mukesh27.
Fixes#60895.
git-svn-id: https://develop.svn.wordpress.org/trunk@58283 602fd350-edb4-49c9-b593-d223f7449a82
Provides a custom decoder for strings coming from HTML attributes and
markup. This custom decoder is necessary because of deficiencies in
PHP's `html_entity_decode()` function:
- It isn't aware of 720 of the possible named character references in
HTML, leaving many out that should be translated.
- It isn't aware of the ambiguous ampersand rule, which allows
conversion of character references in certain contexts when they
are missing their closing `;`.
- It doesn't draw a distinction for the ambiguous ampersand rule
when decoding attribute values instead of markup values.
- Use of `html_entity_decode()` requires manually passing non-default
paramter values to ensure it decodes properly.
This decoder also provides some conveniences, such as making a
single-pass and interruptable decode operation possible. This will
provide a number of opportunities to optimize detection and decoding
of things like value prefixes, and whether a value contains a given
substring.
Developed in https://github.com/WordPress/wordpress-develop/pull/6387
Discussed in https://core.trac.wordpress.org/ticket/61072
Props dmsnell, gziolo, jonsurrell, jorbin, westonruter, zieladam.
Fixes#61072.
git-svn-id: https://develop.svn.wordpress.org/trunk@58281 602fd350-edb4-49c9-b593-d223f7449a82
Provide users with the ability to style entire sections of a page without
having to tediously reapply the same sets of styles.
This is done by extending block style variations to apply to nested blocks.
See https://github.com/WordPress/gutenberg/pull/57908.
Fixes#61312.
Props aaronrobertshaw, talldanwp, ramonopoly, isabel_brison, andrewserong.
git-svn-id: https://develop.svn.wordpress.org/trunk@58264 602fd350-edb4-49c9-b593-d223f7449a82
Allow using relative `file:` URLs in top-level theme.json properties such as
`styles.background`, and modify the REST API to provide clients with the
absolute URLs via a 'https://api.w.org/theme-file' attribute in the `_links`
array.
Props ramonopoly.
Fixes#61273.
git-svn-id: https://develop.svn.wordpress.org/trunk@58262 602fd350-edb4-49c9-b593-d223f7449a82
Handle `$preferred_ext` arguments that are passed with minor errors in formatting, such as incorrect casing or missing `.`. Add unit tests to verify that an omitted period on an otherwise correct extension is accepted. Follow up to [57687].
Props sabernhardt, joedolson, khokansardar.
Fixes#60610.
git-svn-id: https://develop.svn.wordpress.org/trunk@58248 602fd350-edb4-49c9-b593-d223f7449a82
Updates the `WP_Block_Styles_Registry` class to allow registering an array of blocks.
Props aaronrobertshaw, talldanwp, isabel_brison.
Fixes#61274.
git-svn-id: https://develop.svn.wordpress.org/trunk@58246 602fd350-edb4-49c9-b593-d223f7449a82
Ensures that feature-level selectors for block style variations are correctly scoped when generating a theme.json stylesheet.
Props aaronrobertshaw, audrasjb, vcanales, isabel_brison.
Fixes#61119.
git-svn-id: https://develop.svn.wordpress.org/trunk@58244 602fd350-edb4-49c9-b593-d223f7449a82
Adjusts the block level global styles selectors so they have a consistent specificity of 0-1-0, and adjusts base and layout global style selectors to their minimum required specificity.
Props aaronrobertshaw, isabel_brison, andrewserong, mukesh27.
Fixes#61165.
git-svn-id: https://develop.svn.wordpress.org/trunk@58241 602fd350-edb4-49c9-b593-d223f7449a82
Integrates the directives processing into the WP_Block class. It removes the overhead of running additional hooks when rendering blocks and simplifies the way we detect whether the directive processing should run on an interactive region of the produced final HTML for the blocks.
Introduces `interactivity_process_directives` filter to offer a way to opt out from directives processing. It's needed in Gutenberg: https://github.com/WordPress/gutenberg/pull/62095.
Props gziolo, cbravobernal.
Fixes#61185.
git-svn-id: https://develop.svn.wordpress.org/trunk@58234 602fd350-edb4-49c9-b593-d223f7449a82
The Tag Processor stores the byte-offsets into its HTML document where
the current token starts and ends, and also for every bookmark. In some
cases for tags, the end offset has been off by one.
In this patch the offset is fixed so that a bookmark always properly
refers to the full span of the token it's bookmarking. Also the current
token byte offsets are properly recorded.
While this is a defect in the Tag Processor, it hasn't been exposed
through the public interface and has not affected any of the working
of the processor. Only subclasses which rely on the length of a bookmark
have been potentially affected, and these are not supported environments
in the ongoing work.
This fix is important for future work and for ensuring that subclasses
performing custom behaviors remain as reliable as the public interface.
Developed in https://github.com/WordPress/wordpress-develop/pull/6625
Discussed in https://core.trac.wordpress.org/ticket/61301
Props dmsnell, gziolo, jonsurrell, westonruter.
Fixes#61301.
git-svn-id: https://develop.svn.wordpress.org/trunk@58233 602fd350-edb4-49c9-b593-d223f7449a82
In order to render the block template in the locked template preview inside the post editor we need to be able to fetch the contents of any block templates/template parts for any user role that can edit a post.
Props fabiankaegy, youknowriad.
Fixes#61137.
git-svn-id: https://develop.svn.wordpress.org/trunk@58227 602fd350-edb4-49c9-b593-d223f7449a82
Improve the behaviour of global padding when useRootPaddingAwareAlignments is enabled in theme.json to be more consistent across blocks, templates and patterns.
Props richtabor, isabel_brison, andrewserong.
Fixes#61304.
git-svn-id: https://develop.svn.wordpress.org/trunk@58226 602fd350-edb4-49c9-b593-d223f7449a82
Updated the global styles endpoints in the REST API to extend from existing posts and revisions controllers. This reduces duplicated code and inconsistencies. The revisions controller is now a subclass of the `WP_REST_Revisions_Controller`. Related redundant methods were removed and schema generation and collection parameters were adjusted to suit the global styles context. Updated permission checks, constructor, and collection parameters accordingly. This change allows for easy override of these classes using the `register_post_type_args` filter.
This reintroduces [57624] (reverted in [57628]) with improved backward compatibility and further enhancements.
Props ramonopoly, spacedmonkey, mukesh27, swissspidy.
Fixes#60131.
git-svn-id: https://develop.svn.wordpress.org/trunk@58225 602fd350-edb4-49c9-b593-d223f7449a82
Syncs the necessary changes from Gutenberg to allow setting site-wide
background images using the top-level `styles.background` key in `theme.json`.
Props ramonopoly.
Fixes#61123.
git-svn-id: https://develop.svn.wordpress.org/trunk@58222 602fd350-edb4-49c9-b593-d223f7449a82
Replaces various boolean assertions wrapping `file_exists()` with either `assertFileExists()` or `assertFileDoesNotExist()` as appropriate for the test.
Props peterwilsoncc, mukesh27.
See #60705.
git-svn-id: https://develop.svn.wordpress.org/trunk@58221 602fd350-edb4-49c9-b593-d223f7449a82