The `$for_user_id` parameter is an `int`, not a `string`, so the default value should be `0`, rather than an empty string.
Props subrataemfluence.
Fixes#44697.
git-svn-id: https://develop.svn.wordpress.org/trunk@44603 602fd350-edb4-49c9-b593-d223f7449a82
The `$force` parameter is a `bool`, not a `string`. The matching `wp_cache_get()` docblock has the correct type.
Props subrataemfluence.
Fixes#44454.
git-svn-id: https://develop.svn.wordpress.org/trunk@44601 602fd350-edb4-49c9-b593-d223f7449a82
In the `@return` tag description for `get_post_modified_time()`, `get_the_time()`, and `get_post_time()`, the `$d` parameter is incorrectly referred to as `$id`.
Props behzod.
Fixes#45323.
git-svn-id: https://develop.svn.wordpress.org/trunk@44592 602fd350-edb4-49c9-b593-d223f7449a82
This is a followup to [42828], ensuring that the `get_{$adjacent}_post_excluded_terms` filter is always passed an array, as expected.
Props soulseekah, zottto.
Fixes#43521.
git-svn-id: https://develop.svn.wordpress.org/trunk@44591 602fd350-edb4-49c9-b593-d223f7449a82
This sanitisation only needs to be run in `::update()` to correctly clean up the input.
Props welcher, greenshady.
Fixes#42461.
git-svn-id: https://develop.svn.wordpress.org/trunk@44589 602fd350-edb4-49c9-b593-d223f7449a82
What age were you when you learned that there's a `$user_id` global, as well as `$user_ID` global? I was today years old.
Props pento, mukesh27.
Fixes#43448.
git-svn-id: https://develop.svn.wordpress.org/trunk@44586 602fd350-edb4-49c9-b593-d223f7449a82
When `home` and `siteurl` are different, the customizer preview iframe will be blank in Chrome and Safari, due to their `X-Frame-Options` implementation quirks.
Changing this to `SAMEORIGIN` and adding the `frame-ancestors` Content Security Policy gives the correct behaviour.
Props fullyint.
Fixes#40020.
git-svn-id: https://develop.svn.wordpress.org/trunk@44580 602fd350-edb4-49c9-b593-d223f7449a82
[41215] supresses these irrelevant error messages from the front end, this removes them from the error log, too.
Props jeherve.
Fixes#43815.
git-svn-id: https://develop.svn.wordpress.org/trunk@44578 602fd350-edb4-49c9-b593-d223f7449a82
This contains a copy of the block, unmodified by other filter functions, so that plugins have a clean reference to work from, if they need.
Props dmsnell.
Fixes#45451.
git-svn-id: https://develop.svn.wordpress.org/trunk@44576 602fd350-edb4-49c9-b593-d223f7449a82
From the `WordPress.NamingConventions.ValidVariableName` sniff, this commit fixes/whitelists all `NotSnakeCaseMemberVar`, `MemberNotSnakeCase`, and `StringNotSnakeCase` violations. It also fixes a handful of the `NotSnakeCase` violations.
See #45934.
git-svn-id: https://develop.svn.wordpress.org/trunk@44573 602fd350-edb4-49c9-b593-d223f7449a82
Of the last four instances of `extract()` occurring, three of them are removed by this commit, and the fourth is appropriately documented.
See #45934.
git-svn-id: https://develop.svn.wordpress.org/trunk@44569 602fd350-edb4-49c9-b593-d223f7449a82
Calling `register_rest_route()` too early in the loading process has the potential to cause some unintentional problems and pitfalls. Because `register_rest_route()` calls `rest_get_server()` (which creates the `WP_REST_Server` instance), calling the function directly and/or before `rest_api_init` should be discouraged.
For example, if `register_rest_route ()` is called on `init`, the REST API server instance is set up (and all functions added to `rest_api_init` and other related hooks are invoked), even though the current request may not be a REST request. Also, if `register_rest_route()` is called even earlier (say, in an `mu-plugin` file), required endpoints may be missing since normal plugins have not yet been loaded and have not had a chance to register their own action hooks.
This adds a `_doing_it_wrong()` notice the first time `register_rest_route()` is called before `rest_api_init` in a request to encourage best practices for registering REST API routes.
Props kraftbj, desrosj, timothyblynjacobs.
Fixes#45265.
git-svn-id: https://develop.svn.wordpress.org/trunk@44568 602fd350-edb4-49c9-b593-d223f7449a82
Both `wp_encode_emoji()` and `wp_staticize_emoji()` perform a PHP version check when deciding how to apply their behaviour, but this check only needs to happen once, rather than every time in their internal looks.
Moving the check outside of the loop reduces processing time by 50%.
Props johnbillion.
Fixes#45930.
git-svn-id: https://develop.svn.wordpress.org/trunk@44554 602fd350-edb4-49c9-b593-d223f7449a82
At the start of `render_block()`, the `pre_render_block` filter allows the function to be short-circuited, and the `render_block_data` filter is applied to the `$block` parameter before it's processed.
Props kkarpieszuk, pento.
Fixes#45451.
git-svn-id: https://develop.svn.wordpress.org/trunk@44553 602fd350-edb4-49c9-b593-d223f7449a82
WordPress has historically often used code like `preg_split( '/[\s,]+/', $var )` to parse a string of comma-separated values into an array. However, this approach was causing an empty string to not be parsed into an empty array as expected, but rather into an array with the empty string as its sole element.
This was among other areas causing problems in the REST API where passing an empty request parameter could cause that request to fail because, instead of it being ignored, that parameter would be compared against the valid values for it, which typically do not include an empty string.
Props david.binda, sstoqnov.
Fixes#43977.
git-svn-id: https://develop.svn.wordpress.org/trunk@44546 602fd350-edb4-49c9-b593-d223f7449a82
Introduces in core new focus styles dedicated to Windows High Contrast mode. The
new styles use a transparent CSS outline as already explored in the Block Editor.
This first part covers some of the main user interface controls like buttons, links,
and media views elements. Other parts will be addressed in the next future.
Fixes#41286.
git-svn-id: https://develop.svn.wordpress.org/trunk@44544 602fd350-edb4-49c9-b593-d223f7449a82
Sometimes, Safari and VoiceOver read out the text hidden with `screen-reader-text`
in a wrong order. While there's no known, full, solution, it is possible to make
them respect the correct order reliably at least within buttons.
Fixes#42006.
git-svn-id: https://develop.svn.wordpress.org/trunk@44543 602fd350-edb4-49c9-b593-d223f7449a82
This function was introduced in 5.0.1, not 4.9.9 as currently indicated. Introduced in [44047].
git-svn-id: https://develop.svn.wordpress.org/trunk@44540 602fd350-edb4-49c9-b593-d223f7449a82
The `keyup` event was used to provide support for IE8, where which doesn't support the `input` event. As we dropped IE8 support some time ago, this was simply adding unnecessary complexity and double-event triggers.
Props dlh, afercia.
Fixes#32882.
git-svn-id: https://develop.svn.wordpress.org/trunk@44539 602fd350-edb4-49c9-b593-d223f7449a82
This solution does not work with custom taxonomies in the current state.
Reverts [42614,42619,42737].
Props danielbachhuber.
See #38922.
git-svn-id: https://develop.svn.wordpress.org/trunk@44537 602fd350-edb4-49c9-b593-d223f7449a82
In [41746], `wp_get_media_creation_timestamp()` was introduced to read the created timestamp for videos from `getID3` in meta whenever possible. This information is useful separately from the dates on the file itself.
This adds the same support audio files by utilizing `wp_get_media_creation_timestamp()` in `wp_read_audio_metadata()`.
Props blob folio, desrosj.
Fixes#42017.
git-svn-id: https://develop.svn.wordpress.org/trunk@44528 602fd350-edb4-49c9-b593-d223f7449a82
This changeset introduces a `WP_Shutdown_Handler` class that detects fatal errors and which extension (plugin or theme) causes them. Such an error is then recorded, and an error message is displayed. Subsequently, in certain protected areas, for example the admin, the broken extension will be paused, ensuring that the website is still usable in the respective area. The major benefit is that this mechanism allows site owners to still log in to their website, to fix the problem by either disabling the extension or solving the bug and then resuming the extension.
Extensions are only paused in certain designated areas. The frontend for example stays unaffected, as it is impossible to know what pausing the extension would cause to be missing, so it might be preferrable to clearly see that the website is temporarily not accessible instead.
The fatal error recovery is especially important in scope of encouraging the switch to a maintained PHP version, as not necessarily every WordPress extension is compatible with all PHP versions. If problems occur now, non-technical site owners that do not have immediate access to the codebase are not locked out of their site and can at least temporarily solve the problem quickly.
Websites that have custom requirements in that regard can implement their own shutdown handler by adding a `shutdown-handler.php` drop-in that returns the handler instance to use, which must be based on a class that inherits `WP_Shutdown_Handler`. That handler will then be used in place of the default one.
Websites that would like to modify specifically the error template displayed in the frontend can add a `php-error.php` drop-in that works similarly to the existing `db-error.php` drop-in.
Props afragen, bradleyt, flixos90, ocean90, schlessera, SergeyBiryukov, spacedmonkey.
Fixes#44458.
git-svn-id: https://develop.svn.wordpress.org/trunk@44524 602fd350-edb4-49c9-b593-d223f7449a82
Makes sure there is no empty space when a user can manage terms but lacks the capability to edit terms.
Props mathieuhays, marcwieland95.
Fixes#43743.
git-svn-id: https://develop.svn.wordpress.org/trunk@44515 602fd350-edb4-49c9-b593-d223f7449a82
Instead of turning the return value of `stream_get_wrappers()` into a regex to match the scheme, we can instead extract the scheme and search the return value of `stream_get_wrappers()`.
Props schlessera, swissspidy.
Fixes#45553.
git-svn-id: https://develop.svn.wordpress.org/trunk@44506 602fd350-edb4-49c9-b593-d223f7449a82
Twenties Ten through Seventeen have been updated to properly escape the pingback URL. Twenty Nineteen is already escaping the URL.
Props soulseekah, sharaz.
Fixes#43717.
git-svn-id: https://develop.svn.wordpress.org/trunk@44500 602fd350-edb4-49c9-b593-d223f7449a82
This function splits the `get_avatar_comment_types` filter out of `get_avatar_data()`.
Props dshanske, birgire.
Fixes#44033.
git-svn-id: https://develop.svn.wordpress.org/trunk@44499 602fd350-edb4-49c9-b593-d223f7449a82
Previously, the link to the privacy policy guide would only be displayed when a privacy policy page had been selected, but the guide is generally useful without that.
Props mukesh27, birgire.
Fixes#44871.
git-svn-id: https://develop.svn.wordpress.org/trunk@44492 602fd350-edb4-49c9-b593-d223f7449a82
When an invalid username or email address is entered, the form now displays a better error message.
Props mrtortai, iamfriendly, TomHarrigan, afercia, pento.
Fixes#31788.
git-svn-id: https://develop.svn.wordpress.org/trunk@44489 602fd350-edb4-49c9-b593-d223f7449a82
This should make cron spawning faster by ensuring requests to wp-cron.php return immediately regardless of transport method. It is enabled only on recent PHP versions with fastcgi, due to historical bugs and availability of `fastcgi_finish_request()`. This needs testing on a range of platforms, to help determine if it's safe to use in other contexts also.
Props vnsavage, johnbillion, jnylen0.
See #18738, #41358
git-svn-id: https://develop.svn.wordpress.org/trunk@44488 602fd350-edb4-49c9-b593-d223f7449a82
As many WordPress sites use a static homepage rather than a blog, this link gives a natural next step for new sites owners wanting to configure their site in this manner.
Props professor44, joyously, nielslange, mukesh27, melchoyce.
Fixes#45019.
git-svn-id: https://develop.svn.wordpress.org/trunk@44485 602fd350-edb4-49c9-b593-d223f7449a82
Add the function `wp_get_ready_cron_jobs()` to return a modified version of the cron array limited to jobs ready to be run, ie with a timestamp of `time()` or earlier.
The new function includes the filter `pre_get_ready_cron_jobs` to allow for custom cron storage systems. This rounds out the functionality added in #32656.
Props Pento for code review.
Fixes#45797.
git-svn-id: https://develop.svn.wordpress.org/trunk@44483 602fd350-edb4-49c9-b593-d223f7449a82
This filter allows the query arguments to be manipulated for a post search query in the REST API.
Props Chouby, swissspidy.
Fixes#45454.
git-svn-id: https://develop.svn.wordpress.org/trunk@44482 602fd350-edb4-49c9-b593-d223f7449a82
The `$relative_file` and `$stylesheet` variables are used in the `wp_print_theme_file_tree()` function but were not noted within the inline documentation.
Props mukesh27, desrosj,
Fixes#43682.
git-svn-id: https://develop.svn.wordpress.org/trunk@44477 602fd350-edb4-49c9-b593-d223f7449a82
After [42832], [42891] and [43006], this changeset refines the core notice informing about an outdated PHP version:
* The link to the Update PHP information page can now be adjusted using either a `WP_UPDATE_PHP_URL` environment variable, or a new `wp_update_php_url` filter.
* If that URL is different from the default one that points to https://wordpress.org/support/update-php/ or its localized equivalent, a note indicates that the linked resource has not been provided by WordPress itself, and the default URL is still linked to as an additional resource.
* The URL for the default information page has been updated to use the slug `update-php` instead of `upgrade-php`.
* `@since` annotations have been updated.
Going forward, admin areas that display information related to the PHP version should use the new function `wp_get_update_php_url()`.
Props afragen, fierevere, flixos90, markjaquith, miss_jwo, nerrad, pento, schlessera, SergeyBiryukov, spacedmonkey.
Fixes#45686. See #41191.
git-svn-id: https://develop.svn.wordpress.org/trunk@44476 602fd350-edb4-49c9-b593-d223f7449a82
The order of the type and variable name in the `param` tags for the `wp_get_default_privacy_policy_content` filter is incorrectly reversed. This moves the two into the correct order.
Props ishitaka, mukesh27.
Fixes#45416.
git-svn-id: https://develop.svn.wordpress.org/trunk@44475 602fd350-edb4-49c9-b593-d223f7449a82
An integer comparison is performed against `control.currentErrorAnnotations`, but `control.currentErrorAnnotations` is actually an array. This fixes that comparison so the content saves correctly.
Props barryceelen.
Fixes#43657.
git-svn-id: https://develop.svn.wordpress.org/trunk@44474 602fd350-edb4-49c9-b593-d223f7449a82
By providing distinct files for the site and network APIs, a better overview is provided. Prior to this change, the `ms-blogs.php` file had grown too big, mixing site APIs, network APIs and related legacy APIs that need to be maintained. Since multisite is often used in unexpected ways, backward-compatibility is ensured by including the two new files from `ms-blogs.php`, which previously contained all functions that have been moved to the new files.
This changeset does not contain any functional changes.
Fixes#40647.
git-svn-id: https://develop.svn.wordpress.org/trunk@44472 602fd350-edb4-49c9-b593-d223f7449a82
This complements the work in [43729] and prepares site metadata for future REST API support.
Props spacedmonkey.
Fixes#45091. See #44467.
git-svn-id: https://develop.svn.wordpress.org/trunk@44468 602fd350-edb4-49c9-b593-d223f7449a82
- Add a border below the heading, to match meta boxes.
- Remove the colons from the input labels.
- Tweak the padding and margins.
Props birgire, abdullahramzan, rhetorical, BODA1982, pento.
Fixes#43586.
git-svn-id: https://develop.svn.wordpress.org/trunk@44466 602fd350-edb4-49c9-b593-d223f7449a82
The documented `$default_text_color` parameter isn't passed, and the `$video` parameter is passed, but not documented.
Props mukesh27.
Fixes#44920.
git-svn-id: https://develop.svn.wordpress.org/trunk@44462 602fd350-edb4-49c9-b593-d223f7449a82
`WP_Customize_Control` is the parent class of `WP_Customize_Nav_Menu_Locations_Control`.
Props utsav72640.
Fixes#45570.
git-svn-id: https://develop.svn.wordpress.org/trunk@44458 602fd350-edb4-49c9-b593-d223f7449a82
As of this commit, WordPress is no longer a simple blogging platform. It's now a comprehensive publishing solution.
This also replaces a couple of other "blog" references that were missed previously.
Props igmoweb, Valer1e, audrasjb, pento.
Fixes#41000.
git-svn-id: https://develop.svn.wordpress.org/trunk@44455 602fd350-edb4-49c9-b593-d223f7449a82
Returning a non-`null` value on this fillter will cause `wp_unique_post_slug()` to return early with that value, skipping potentially expensive database queries on some sites.
Props coffee2code, javorszky, iCaleb.
Fixes#21112.
git-svn-id: https://develop.svn.wordpress.org/trunk@44454 602fd350-edb4-49c9-b593-d223f7449a82
Setting `WP_DEBUG_LOG` to a file path will now cause the debug log to be written to that file, rather than the default `WP_CONTENT_DIR/debug.log`.
Props SergeyBiryukov, ethitter, sebastian.pisula, nacin.
Fixes#18391.
git-svn-id: https://develop.svn.wordpress.org/trunk@44453 602fd350-edb4-49c9-b593-d223f7449a82
Ordering by `post__in` was introduced in [21776], but the code assumed that
`post__in` would be a comma-separated string listing post IDs. When an array
of post IDs was passed to the `post__in` query var, 'orderby=post__in' was
not respected. This changeset changes this behavior by handling
'orderby=post__in' in the same way as most other values of 'orderby',
which ensures that arrays as well as strings can be properly parsed.
The same treatment is given to the similar `post_name__in` and
`post_parent__in` options of 'orderby', so that most query generation for
orderby clauses happens in the same place, instead of in special cases.
A slight change in the resulting SQL (related to the whitespace around
parentheses and commas) necessitates a change to an existing REST API test
that does a string comparison against the SQL query.
Props mgibbs189, kelvink.
Fixes#38034.
git-svn-id: https://develop.svn.wordpress.org/trunk@44452 602fd350-edb4-49c9-b593-d223f7449a82
This adds some special case handling in 'wp_check_filetype_and_ext()' that prevents some common file types from being blocked based on mismatched MIME checks, which were made more strict in WordPress 5.0.1.
Props Kloon, birgire, tellyworth, joemcgill.
See #45615.
git-svn-id: https://develop.svn.wordpress.org/trunk@44438 602fd350-edb4-49c9-b593-d223f7449a82
Currently, when viewing the block editor with JavaScript disabled, the user sees a blank admin page with the admin menu sidebar. This adds an admin notice informing the user that JavaScript is required for the new block editor.
Props mkaz, pento, azaozz, ocean90, desrosj.
Fixes#45453.
git-svn-id: https://develop.svn.wordpress.org/trunk@44437 602fd350-edb4-49c9-b593-d223f7449a82
Update the theme versions and release dates for the default themes, in time for WordPress 5.0.3.
The POT file for Twenty Eleven has also been updated.
Props laurelfulford.
Fixes#45792.
git-svn-id: https://develop.svn.wordpress.org/trunk@44435 602fd350-edb4-49c9-b593-d223f7449a82
Removes `file_exist()` checks before calling `load_script_translations()` to let the determined paths be passed to `load_script_translations()` which provides its own file check and the possibility to filter the path.
Props swissspidy, johnbillion, ocean90.
See #45769.
git-svn-id: https://develop.svn.wordpress.org/trunk@44418 602fd350-edb4-49c9-b593-d223f7449a82
See [42808] for `Walker_Nav_Menu`.
The `aria-current` attribute is a simple, effective way to help assistive
technologies users orientate themselves within a list of items. Continues the
introduction in core of `aria-current` after [42440], [41683], [41359], and [41371].
Props chetan200891, wpzinc.
Fixes#43522.
git-svn-id: https://develop.svn.wordpress.org/trunk@44416 602fd350-edb4-49c9-b593-d223f7449a82
Don't add an empty `class` attribute if there are no classes, for consistency with `Walker_Nav_Menu::start_el()`.
Props abhijitrakas, mukesh27.
Fixes#44880.
git-svn-id: https://develop.svn.wordpress.org/trunk@44415 602fd350-edb4-49c9-b593-d223f7449a82
Don't add an empty `class` attribute if there are no classes, for consistency with `Walker_Nav_Menu::start_el()`.
Props abhijitrakas, mukesh27.
See #44880.
git-svn-id: https://develop.svn.wordpress.org/trunk@44414 602fd350-edb4-49c9-b593-d223f7449a82
Revert unintended change to the `@since` tag for the `WP_User_Query` instance added to `found_users_query` filter in [43660].
See #44169, #43679.
git-svn-id: https://develop.svn.wordpress.org/trunk@44410 602fd350-edb4-49c9-b593-d223f7449a82
The inline JavaScript added by `WP_Scripts::print_translations()` should check whether `locale_data.$text_domain` exists and fall back to `locale_data.messages` otherwise.
Props swissspidy.
See #45441.
git-svn-id: https://develop.svn.wordpress.org/trunk@44403 602fd350-edb4-49c9-b593-d223f7449a82
Twenty Seventeen's original styles for the block editor custom colors had some issues: they weren't being applied to the button blocks due to lack of specificity, and when applied to paragraph blocks, there was no padding in the editor. This update makes sure the colors and related styles work as expected.
Fixes#45426.
git-svn-id: https://develop.svn.wordpress.org/trunk@44402 602fd350-edb4-49c9-b593-d223f7449a82
In [44398], an inline comment was introduced that did not refer to the new editor as the Block Editor. This corrects that comment.
See #45788.
git-svn-id: https://develop.svn.wordpress.org/trunk@44399 602fd350-edb4-49c9-b593-d223f7449a82