This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.
Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes#54225.
Built from https://develop.svn.wordpress.org/trunk@55210
git-svn-id: http://core.svn.wordpress.org/trunk@54743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
On some servers, consecutive periods in a filename can cause a 403 Forbidden response.
This changeset replaces consecutive periods with a single period, and adds related unit tests.
Props ArtZ91, costdev, SergeyBiryukov, arthurshlain, mukesh27.
Fixes#57242.
Built from https://develop.svn.wordpress.org/trunk@55209
git-svn-id: http://core.svn.wordpress.org/trunk@54742 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Formally deprecate `get_page_by_title()`. In its current form the function is unpredictable in that it may return a result that leads to a 404 error and will return different results depending on the database version/engine combination used.
It is recommended developers use `WP_Query` instead:
{{{
$query = new WP_Query(
array(
'post_type' => 'page',
'title' => 'Sample Page',
)
);
}}}
Props TimothyBlynJacobs, costdev, mukesh27, spacedmonkey, peterwilsoncc.
Fixes#57041.
Built from https://develop.svn.wordpress.org/trunk@55207
git-svn-id: http://core.svn.wordpress.org/trunk@54740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces:
- New function: `wp_opcache_invalidate_directory()`, to recursively call `wp_opcache_invalidate()` after overwriting .php files.
- New function: `move_dir()`, similar to `copy_dir()` that uses `WP_Filesystem::move()` followed by `wp_opcache_invalidate_directory()`, and has a fallback to `copy_dir()`.
Props: costdev, afragen, peterwilsoncc, sergeybiryukov, ironprogrammer, flixos90, bronsonquick, mukesh27, azaozz.
Fixes#57375.
Built from https://develop.svn.wordpress.org/trunk@55204
git-svn-id: http://core.svn.wordpress.org/trunk@54737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit pulls in the HTML Tag Processor from the Gutenbeg repository.
The Tag Processor attempts to be an HTML5-spec-compliant parser that provides the ability in PHP to find specific HTML tags and then add, remove, or update attributes on that tag. It provides a safe and reliable way to modify the attribute on HTML tags.
More information: https://github.com/WordPress/wordpress-develop/pull/3920.
Props: antonvlasenko, bernhard-reiter, costdev, dmsnell, felixarntz, gziolo, hellofromtonya, zieladam, flixos90, ntsekouras, peterwilsoncc, swissspidy, andrewserong, onemaggie, get_dave, aristath, scruffian, justlevine, andraganescu, noisysocks, dlh, soean, cbirdsong, revgeorge, azaozz.
Fixes#57575.
Built from https://develop.svn.wordpress.org/trunk@55203
git-svn-id: http://core.svn.wordpress.org/trunk@54736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When switching to a block theme, classic sidebars were orphaned and their widgets remapping to the `'wp_inactive_widgets'` sidebar . This changeset preserves the sidebars and their widgets, providing a migration path to a block theme without losing the widgets.
Classic sidebars are now:
* Stored in a new theme mod called `'wp_classic_sidebars'`;
* Restored to the `$wp_registered_sidebars` global variable when the `'widgets_init'` action fires (via a new internal function called `_wp_block_theme_register_classic_sidebars()`);
* And marked as `'inactive'` when interacting with sidebars REST API endpoint.
References:
* [https://github.com/WordPress/gutenberg/pull/45509 Gutenberg PR 45509] which adds an option for importing widgets from sidebars into template parts.
Follow-up to [50995], [6334].
Props mamaduka, audrasjb, hellofromTonya, ironprogrammer, jameskoster, joen, matveb, mukesh27, noisysocks, poena, youknowriad.
Fixes#57531.
Built from https://develop.svn.wordpress.org/trunk@55200
git-svn-id: http://core.svn.wordpress.org/trunk@54733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset makes it easier for users to download their uploaded media by providing a Download row action to the Media List Table. It also rephrases the Copy URL row action for better consistency and to give room for the new Download action.
Follow-up to [55156].
Props pbiron, joedolson, kebbet, Mista-Flo, costdev, amin7, mukesh27.
Fixes#57574.
Built from https://develop.svn.wordpress.org/trunk@55198
git-svn-id: http://core.svn.wordpress.org/trunk@54731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset rephrases the Add Plugins screen description to clarify the purpose of the two available options for installing plugins.
Props tahmidulkarim, audrasjb, costdev, ryokuhi, krupalpanchal, SergeyBiryukov.
Fixes#57155.
Built from https://develop.svn.wordpress.org/trunk@55197
git-svn-id: http://core.svn.wordpress.org/trunk@54730 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In [53874] the `$locale` parameter was added to `load_textdomain()` so it can be used to properly fill `WP_Textdomain_Registry`. Since `$locale` may not be the same value as `determine_locale()` returns (e.g. when filtered by `plugin_locale` in `load_plugin_textdomain()`) this changeset also passes the `$locale` parameter to the filter so custom file loading implementations are using the same locale as `load_textdomain()` got.
Follow-up to [53874].
Props ocean90, cadic, SergeyBiryukov, swissspidy, costdev.
Fixes#57056.
Built from https://develop.svn.wordpress.org/trunk@55196
git-svn-id: http://core.svn.wordpress.org/trunk@54729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit removes the need to pass a template prefix in get_template_hierarchy.
This is required because, in some block editor usages, the template prefix is not known.
Props youknowriad, davidbaumwald, jorgefilipecosta.
Fixes#57614.
Built from https://develop.svn.wordpress.org/trunk@55194
git-svn-id: http://core.svn.wordpress.org/trunk@54727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset introduces functions `wp_get_global_styles_custom_css()` and `wp_enqueue_global_styles_custom_css()`, which allow accessing and enqueuing custom CSS added via global styles.
Custom CSS via global styles is handled separately from custom CSS via the Customizer. If a site uses both features, the custom CSS from both sources will be loaded. The global styles custom CSS is then loaded after the Customizer custom CSS, so if there are any conflicts between the rules, the global styles take precedence.
Similarly to e.g. [55185], the result is cached in a non-persistent cache, except when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.
Props glendaviesnz, oandregal, ntsekouras, mamaduka, davidbaumwald, hellofromtonya, flixos90.
Fixes#57536.
Built from https://develop.svn.wordpress.org/trunk@55192
git-svn-id: http://core.svn.wordpress.org/trunk@54725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This updates the following npm dependencies to their latest versions:
- `chalk` from `5.1.0` to `5.2.0`.
- `dotenv-expand` from `9.0.0` to `10.0.0`.
- `grunt-contrib-qunit` from `6.2.0` to `6.2.1`.
- `prettier` from `2.0.5` to `2.6.2`.
- `qunit` from `2.19.1` to `2.19.4`.
- `sass` from `1.55.0` to `1.58.0`.
- `sinon` from `14.0.1` to `15.0.1`.
- `sinon-test` from `3.1.4` to `3.1.5`.
- `source-map-loader` from `4.0.0` to `4.0.1`.
- `uglify-js` from `3.17.3` to `3.17.4`.
- `wait-on` from `6.0.1` to `7.0.1`.
- `webpack` from `5.74.0` to `5.75.0`.
Additionally, `npm audit fix` has been run to further update packages that may contain vulnerabilities.
Props naeemhaque, mukesh27, desrosj.
See #57535.
Built from https://develop.svn.wordpress.org/trunk@55191
git-svn-id: http://core.svn.wordpress.org/trunk@54724 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This resolves a few WPCS warnings:
{{{
Variable "$cat_ID" is not in valid snake_case format, try "$cat_i_d"
}}}
Follow-up to [2695], [4490], [52958].
Props hilayt24, viralsampat, desrosj, robinwpdeveloper, tanazmasaba, costdev, SergeyBiryukov.
See #56754.
Built from https://develop.svn.wordpress.org/trunk@55190
git-svn-id: http://core.svn.wordpress.org/trunk@54723 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds margins to improve spacing in the legacy Post Comments block. This change only affects users who have not updated to the new Comments block.
Props patelhitesh, audrasjb, poena, miguelaxcar.
Fixes#57560.
Built from https://develop.svn.wordpress.org/trunk@55189
git-svn-id: http://core.svn.wordpress.org/trunk@54722 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset modifies the HTTP request in `themes_api()` to use the same HTTP request timeout as in `plugins_api()`, which is 15 seconds, instead of a default value of 5 seconds.
Props ahortin, peterwilsoncc, dd32, costdev.
Fixes#57315.
Built from https://develop.svn.wordpress.org/trunk@55188
git-svn-id: http://core.svn.wordpress.org/trunk@54721 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset is part of a greater effort to enhance the caching strategy for theme.json based data. Similar to [55138], [55148], and [55155], the cache is currently ignored when `WP_DEBUG` is on to avoid interrupting the theme developer's workflow.
Props spacedmonkey, oandregal, flixos90, ajlende, hellofromtonya.
Fixes#57568.
Built from https://develop.svn.wordpress.org/trunk@55185
git-svn-id: http://core.svn.wordpress.org/trunk@54718 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Crowdsignal has a block-editor powered survey/project editor. Surveys created using this editor appear on `*.crowdsignal.net` when published. This changeset adds oEmbed support for these URLs to embed Crowdsignal surveys.
Props donncha, audrasjb, Mamaduka, ntsekouras.
Fixes#57543.
Built from https://develop.svn.wordpress.org/trunk@55182
git-svn-id: http://core.svn.wordpress.org/trunk@54715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adds the polyfill script to the iframe to make the `inert` attribute work correctly in Firefox. This solves the problem that the site editor can operate on the block editor in Firefox even in browse mode.
Why?
The inert attribute is intended to render the element and its sub-tree elements `inert`, but Firefox doesn't support this attribute. For the `inert` attribute to work as intended in Firefox, even within an iframe, the script needs to be injected into the iframe as well as the global document.
References:
* [https://github.com/WordPress/gutenberg/pull/47398 Gutenberg PR 47398].
Follow-up to [53160].
Props wildworks, mamaduka, youknowriad.
Fixes#57552.
Built from https://develop.svn.wordpress.org/trunk@55181
git-svn-id: http://core.svn.wordpress.org/trunk@54714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset:
* Removes the `'wp-block-editor'` and `'wp-block-library'` from the iframe's stylesheet collection (i.e. `_wp_get_iframed_editor_assets()`).
* Adds the new `'wp-block-editor-content'` for the separate stylesheet to the list of editor (`'wp-edit-blocks'`) dependencies.
Why?
These PHP changes are part of the initiative to:
* Separate the content styles contained in the block editor package into a separate stylesheet.
* Avoid loading all block editor styles into the iframe.
References:
* [https://github.com/WordPress/gutenberg/pull/44298 Gutenberg PR 44298].
Follow-up to [53160], [50761].
Props ellatrix, youknowriad.
Fixes#57550.
Built from https://develop.svn.wordpress.org/trunk@55179
git-svn-id: http://core.svn.wordpress.org/trunk@54712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Unset GET parameters in the media library so they don't suppress error notifications and messages. Fix an issue where uploading an image after being redirected from deleting media did not show the new upload in the gallery.
Props rnitinb, Mista-Flo, desrosj, zebaafiashama, joedolson, antpb.
Fixes#49178.
Built from https://develop.svn.wordpress.org/trunk@55178
git-svn-id: http://core.svn.wordpress.org/trunk@54711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds the new dimension feature's PHP code for supporting minimum height in the block editor inspector and in global styles. Minimum height is quite useful for defining the minimum vertical dimensions of a block, while allowing it to expand beyond that size.
In this changeset:
* Adds support in `theme.json`.
* Adds support in the style engine.
* Adds support in `wp_apply_dimensions_support()`.
* Renames the setting from `'__experimentalDimensions'` to `dimensions` in `wp_register_dimensions_support()`.
* Adds PHPUnit tests.
Is renaming `'__experimentalDimensions'` a backwards-compatibility (BC) break?
Though the setting has been in the code since 5.9.0, it was never wired to anything, ie it did not expose any controls or styles. Notice in `wp_register_dimensions_support()` and `wp_apply_dimensions_support()` prior to this changeset, there are inline comments as placeholders for height and width support, but no code.
If a developer opted in to use it, it had no effect.
A search in wp.org's plugin and themes repo showed no instances of this experimental setting.
Given there was no functionality attached to it (until this changeset), no change in behavior or effect from removing it, and no usage found in the plugins and themes repository, it does appear to be a BC break.
References:
* [https://github.com/WordPress/gutenberg/pull/45300 Gutenberg PR 45300]
* [https://github.com/WordPress/gutenberg/pull/45334 Gutenberg PR 45334]
Follow-up to [53076], [52069].
Props andrewserong, aaronrobertshaw , costdev, hellofromTonya, isabel_brison, joen, paaljoachim, mukesh27, ntsekouras, oandregal, ramonopoly.
Fixes#57582.
Built from https://develop.svn.wordpress.org/trunk@55175
git-svn-id: http://core.svn.wordpress.org/trunk@54708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Includes:
* Adding the `templateTypes` property to the `WP_Block_Patterns_Registry::register()` DocBlock.
* Adding `@since` notes for the `postTypes` and `templateTypes` properties to:
* `_register_theme_block_patterns()`
* `WP_Block_Patterns_Registry::register()`
* Bringing some consistency to the order of properties between:
* `_register_theme_block_patterns()`
* `WP_Block_Patterns_Registry::register()`
* `WP_REST_Block_Patterns_Controller::prepare_item_for_response()`
* `WP_REST_Block_Patterns_Controller::get_item_schema()`
Follow-up to [52943], [53152], [54263], [55168].
See #56792.
Built from https://develop.svn.wordpress.org/trunk@55173
git-svn-id: http://core.svn.wordpress.org/trunk@54706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
To allow editing of block style variations in global styles, this changeset adds the following for server side support:
* building of block style schema into `WP_Theme_JSON::sanitize()`.
* appending of style variation selectors to block metadata in `WP_Theme_JSON::get_blocks_metadata()`.
* building of selectors and variations for nodes in `WP_Theme_JSON::get_block_nodes()`.
Tests for happy and unhappy paths are included.
Reference:
* [https://github.com/WordPress/gutenberg/pull/46343 Gutenberg PR 46343]
Follow-up to [54118], [50973], [50959].
Props isabel_brison,
Fixes#57583.
Built from https://develop.svn.wordpress.org/trunk@55172
git-svn-id: http://core.svn.wordpress.org/trunk@54705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
When adding `decoding="async"` to images was introduced in [53480], it did not provide the ability to customize that behavior specifically for image tags returned from `wp_get_attachment_image()`.
With this changeset it is now possible to explicitly provide a `decoding` value of e.g. boolean `false` in the `$attr` parameter of the function, to ensure the attribute is omitted.
Props maximej, adamsilverstein, flixos90, costdev, peterwilsoncc, mukesh27.
Fixes#57086.
Built from https://develop.svn.wordpress.org/trunk@55171
git-svn-id: http://core.svn.wordpress.org/trunk@54704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace raw database queries in `get_page_by_path` with a call to `WP_Query` class. This has a number of benefits, including improved caching and priming of post caches. To maintain backwards compatibility, this function calls `WP_Query` to gets all matching posts of all post statuses.
Props spacedmonkey, peterwilsoncc, costdev,
Fixes#56689.
Built from https://develop.svn.wordpress.org/trunk@55169
git-svn-id: http://core.svn.wordpress.org/trunk@54702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Backports https://github.com/WordPress/gutenberg/pull/46074 into the core.
render_layout_support_flag is run per block, and inside we called get_global_settings three times. get_global_settings calls get_merged_data, which is costly. render_layout_support_flag is a filter called during the block render. When the blocks start rendering, there is no expectation that the theme.json settings change during the block render, so the settings and their derived information should all be static information of this function.
This simple change removes 3*NUMBER_OF_BLOCKS calls of get_merged_data to just one call.
Props oandregal, aristath, felixarntz, tellthemachines, andrewserong, aaronrobertshaw, aaronrobertshaw.
Built from https://develop.svn.wordpress.org/trunk@55167
git-svn-id: http://core.svn.wordpress.org/trunk@54700 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This changeset adds `$user_id`, `$expire`, `$expiration` and `$token` parameters to provide context to `send_auth_cookies` hook, which allows the filter to skip sending auth cookies.
Props dd32, mukesh27, costdev, peterwilsoncc, audrasjb.
Fixes#56971.
See #39367.
Built from https://develop.svn.wordpress.org/trunk@55164
git-svn-id: http://core.svn.wordpress.org/trunk@54697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit adds inline comments instructing PHPCS to ignore parameters with reserved keywords in the affected methods that should not be renamed:
* `$string` parameter in `WP_Text_Diff_Renderer_inline::_splitOnWords()`
* `$final` parameter in `WP_Text_Diff_Renderer_Table::_changed()` and `::interleave_changed_lines()`
This resolves a few WPCS warnings along the lines of:
{{{
It is recommended not to use reserved keyword "string" as function parameter name. Found: $string
It is recommended not to use reserved keyword "final" as function parameter name. Found: $final
}}}
The two `WP_Text_Diff_Renderer_*` classes in question extend the `Text_Diff_Renderer_inline` and `Text_Diff_Renderer` classes from the `Text_Diff` package and should have the same parameters as the parent class methods, per the Task 1 section of ticket #51553.
The `Text_Diff` library currently included in WordPress core is no longer kept in sync with the upstream project and can be considered “adopted”, so the `$string` and `$final` parameters in the parent class methods can technically be renamed, e.g. to `$input_string` and `$modified`, respectively.
However, the “final” wording is also used to represent modified content in other parts the library, so it is more internally consistent to keep these parameters as is for now.
Follow-up to [7747], [38352], [55136].
See #56788.
Built from https://develop.svn.wordpress.org/trunk@55163
git-svn-id: http://core.svn.wordpress.org/trunk@54696 1a063a9b-81f0-0310-95a4-ce76da25c4cd