The `$credentials['user_login']` and `$credentials['user_password']` parameters are passed by reference to the `wp_authenticate` action, and are at that point [https://www.php.net/manual/en/language.references.pass.php#124383 created as null] if they don't exist in the array.
This commit sets those values to an empty string, resolving two PHP 8.1 deprecation notices:
* One from `preg_replace()` in `wp_strip_all_tags()` via `sanitize_user()` in `wp_authenticate()`:
{{{
Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
}}}
* One from `trim()` in `wp_authenticate()` itself:
{{{
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated
}}}
Includes documenting the `$credentials` parameter using hash notation.
Follow-up to [6643], [37697].
Props lenasterg, TobiasBg, ocean90, afragen, lkraav, SergeyBiryukov.
Fixes#56850.
git-svn-id: https://develop.svn.wordpress.org/trunk@55301 602fd350-edb4-49c9-b593-d223f7449a82
Non-Latin characters are URL-encoded (e.g. `%cf%84%ce%b5%cf%83%cf%84`). Matching `%` in the route ensures templates with non-Latin titles can be properly saved.
Props antonyagrios, mburridge.
Fixes#57329.
git-svn-id: https://develop.svn.wordpress.org/trunk@55294 602fd350-edb4-49c9-b593-d223f7449a82
Internal links should be followed and it should be easier to modify other rel attributes on comments. This adds a helper function for determining if a URL is internal and also adds some new filters to make it easy to modify rel attributes in comments.
Props thomasplevy, desrosj, sabernhardt, benish74, samiamnot, galbaras, jorbin.
Fixes#53290, #56444.
git-svn-id: https://develop.svn.wordpress.org/trunk@55289 602fd350-edb4-49c9-b593-d223f7449a82
In the Gutenberg plugin, a position block support feature was introduced last year, that allows a Group block to be set to a "sticky" position, meaning that when the page scrolls, the block will stick to the top of the window.
This change merges the "sticky" position feature for blocks introduced in Gutenberg 15.0.
Props andrewserong, flixos90, mukesh27.
Fixes#57618.
git-svn-id: https://develop.svn.wordpress.org/trunk@55285 602fd350-edb4-49c9-b593-d223f7449a82
It's not uncommon for local environments to run over HTTP due to the relative complexity of configuring HTTPS for a local environment. This change allows HTTP URLs for application password responses when that is the case.
Props peterwilsoncc, wppunk, cadic, viralsampat
Fixes#52617
git-svn-id: https://develop.svn.wordpress.org/trunk@55283 602fd350-edb4-49c9-b593-d223f7449a82
This changesets adds a `word_count_type` property, so that it does not need to be translated separately across multiple projects.
List of changes:
- New property: `WP_Locale::word_count_type`.
- New method: `WP_Locale::get_word_count_type()`.
- New function: `wp_get_word_count_type()` as a wrapper for `WP_Locale::get_word_count_type()`.
- All `_x( 'words', 'Word count type. Do not translate!' )` strings have been replaced with a call to `wp_get_word_count_type()`.
Props pedromendonca, desrosj, costdev, mukesh27, johnbillion.
Fixes#56698.
git-svn-id: https://develop.svn.wordpress.org/trunk@55279 602fd350-edb4-49c9-b593-d223f7449a82
In `WP_Image_Editor_Imagick`, bail early in `make_subsize()` if the image is already the requested size. Previously, `make_subsize()` would create another copy of the file. `WP_Image_Editor_GD` doesn't have the same problem.
Props wojtekn, danielbachhuber.
Fixes#57370.
git-svn-id: https://develop.svn.wordpress.org/trunk@55278 602fd350-edb4-49c9-b593-d223f7449a82
The appearance tools theme support(merged in [55067]) includes block gap, a feature that was not intended for themes without a theme.json.
Until it has been determined if the feature can and should be enabled in these themes, and has been successfully tested, the appearance tools theme support should be reverted.
Reverts [55067].
Props poena, Mamaduka, audrasjb.
Fixes#57649.
git-svn-id: https://develop.svn.wordpress.org/trunk@55273 602fd350-edb4-49c9-b593-d223f7449a82
The `math` element can be displayed either as a block or inline element. If `wpautop` only treats it as an inline element, it will break multiline elements by inserting `br` elements. Treating the element as a block element means that the editor won't break common normative usages of the `math` element.
Prevent `math` elements from having internal elements split up with `br` elements, disrupting formatting.
Props nicholaswilson, wojtek.szkutnik, hakre, conner_bw, ericlewis, hughie.molloy, SteelWagstaff, ryokuhi, joedolson, bgoewert, adamsilverstein, joedolson.
Fixes#13340.
git-svn-id: https://develop.svn.wordpress.org/trunk@55272 602fd350-edb4-49c9-b593-d223f7449a82
This aims to resolve intermittent test failures due to indeterminate sort order.
Follow-up to [55248].
Props petitphp, costdev, audrasjb, johnbillion.
Fixes#43867.
git-svn-id: https://develop.svn.wordpress.org/trunk@55264 602fd350-edb4-49c9-b593-d223f7449a82
This changeset introduces the `wp_get_attachment_link_attributes` hook to allow developers to filter the link attributes when getting the attachment link.
Props NathanAtmoz, aaroncampbell, antpb, costdev.
Fixes#41574.
git-svn-id: https://develop.svn.wordpress.org/trunk@55262 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a `rel="privacy-policy"` attribute to user-facing links to the Privacy Policy of the website, when a privacy policy page is set and available. While this `rel` value is still a RFC of the Link Types HTML specification, this changeset helps to make Privacy Policy link more discoverable for user agents and HTML parsers.
Props dshanske, audrasjb, bhavz-10, bookwyrm, faisal03, JeffPaul, peterwilsoncc, paapst, davidbaumwald, costdev, robinwpdeveloper, kawserz.
Fixes#56345.
git-svn-id: https://develop.svn.wordpress.org/trunk@55261 602fd350-edb4-49c9-b593-d223f7449a82
Add a new filter `pre_wp_load_alloptions` in the `wp_load_alloptions` function to short circuit the return value.
Props pbearne, spacedmonkey, joyously, SergeyBiryukov, mukesh27, costdev.
Fixes#56045.
git-svn-id: https://develop.svn.wordpress.org/trunk@55256 602fd350-edb4-49c9-b593-d223f7449a82
This changeset introduces a new filter for `wp_save_post_revision()`. `wp_save_post_revision_revisions_before_deletion` passes the revisions to be considered for deletion, and the new revision's post ID.
This allows extenders to exclude specific revisions from being considered for deletion.
Props jhned, costdev, audrasjb, adamsilverstein, mukesh27.
Fixes#57320.
git-svn-id: https://develop.svn.wordpress.org/trunk@55254 602fd350-edb4-49c9-b593-d223f7449a82
In [47938] the `wp_cache_get_multiple` function was added to core. This function allows for multiple cache keys to be received from cache in a single function call. `wp_queue_posts_for_term_meta_lazyload` function does many calls to cache. To get taxonomy relationship for multiple posts and get all terms. Replace calls to `get_object_term_cache` with calls to `wp_cache_get_multiple` and `_prime_term_caches`. This improves performance on sites that implement the `wp_cache_get_multiple` in their object caching drop-in.
Props spacedmonkey, ocean90, SergeyBiryukov, costdev, flixos90, joemcgill, 10upsimon.
Fixes#57150.
git-svn-id: https://develop.svn.wordpress.org/trunk@55252 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the `s` argument of the `WP_Query::parse_query()` method searched the `post_title`, `post_excerpt`, and `post_content` fields, with no way of controlling this apart from using the `posts_search` filter and adjusting the SQL manually. This changeset adds the ability to specify which fields are searched when performing a query, using the `search_columns` argument.
Props johnbillion, birgire, petitphp, audrasjb, costdev, mukesh27.
Fixes#43867.
git-svn-id: https://develop.svn.wordpress.org/trunk@55248 602fd350-edb4-49c9-b593-d223f7449a82
In addition to all the packages being updated to the latest versions,
this commit also includes some mandatory changes to avoid editor breakage:
- Update React to to 18.2.0.
- Add the right stylesheets to support iframed block editors.
Props ntsekouras, mamaduka, flixos90, desrosj, peterwilsoncc.
See #57471.
git-svn-id: https://develop.svn.wordpress.org/trunk@55246 602fd350-edb4-49c9-b593-d223f7449a82
Check the input of `wp_strip_all_tags()` before passing it to `strip_tags()`. This protects against fatal errors introduced in PHP 8, retaining the `E_USER_WARNING` from PHP 7, and prevents a PHP 8.1 deprecation notice when passing null.
Props chocofc1, costdev, jrf, dd32, audrasjb, peterwilsoncc.
Fixes#56434.
git-svn-id: https://develop.svn.wordpress.org/trunk@55245 602fd350-edb4-49c9-b593-d223f7449a82
Introduces a test for the `WP_Error` object `destination_not_deleted_move_dir` in the `move_dir()` function.
Follow up to [55226].
Props costdev, mukesh27.
Fixes#57375.
git-svn-id: https://develop.svn.wordpress.org/trunk@55244 602fd350-edb4-49c9-b593-d223f7449a82
This changeset adds a `block_theme` entry in the theme cache data, similar to the existing entries `headers`, `errors`, `stylesheet`, and `template`.
Props spacedmonkey, costdev, joemcgill, flixos90, mukesh27, adamsilverstein.
Fixes#57114.
git-svn-id: https://develop.svn.wordpress.org/trunk@55236 602fd350-edb4-49c9-b593-d223f7449a82
This commit includes the latest updates WP_Theme_JSON_Resolver class made in the block editor. Some of these updates improve the performance of the class.
Props Mamaduka, hellofromTonya, flixos90, jorgefilipecosta, oandregal, spacedmonkey, audrasjb, costdev, scruffian.
Closes#57545.
git-svn-id: https://develop.svn.wordpress.org/trunk@55231 602fd350-edb4-49c9-b593-d223f7449a82
This is a follow-up to [55161] to rename `::get_current_locale()` to `::get_switched_locale()` and `::get_current_user_id()` to `::get_switched_user_id()` for improved clarity.
Also:
* Fix docblock for `switch_locale` filter. The User ID is `false` if missing, not `null`.
* Add additional test involving `restore_previous_locale()` and improve test cleanup.
And most importantly: happy birthday ocean90! 🎂
Props johnjamesjacoby, ocean90.
See #57123.
git-svn-id: https://develop.svn.wordpress.org/trunk@55224 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55210 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55209 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55207 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55204 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55203 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55200 602fd350-edb4-49c9-b593-d223f7449a82
Add a `$size` argument to `get_attached_file()` to simplify getting the path to an intermediate image size.
Props paulschreiber, audrasjb, Mista-Flo.
Fixes#51780.
git-svn-id: https://develop.svn.wordpress.org/trunk@55199 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55194 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55192 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55185 602fd350-edb4-49c9-b593-d223f7449a82
Updates the Global Styles endpoint to expose the `'edit_css'` capability via action links.
References:
* [https://github.com/WordPress/gutenberg/pull/46815 Gutenberg PR 46815] Part of an effort to hide custom CSS setting for users without `'edit_css'` capability.
Follow-up to [52342], [52051].
Props mamaduka, dsas, glendaviesnz, mmtr86, talldanwp, timothyblynjacobs.
Fixes#57526.
git-svn-id: https://develop.svn.wordpress.org/trunk@55177 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55175 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55173 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55172 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55171 602fd350-edb4-49c9-b593-d223f7449a82
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.
git-svn-id: https://develop.svn.wordpress.org/trunk@55169 602fd350-edb4-49c9-b593-d223f7449a82