3996 Commits

Author SHA1 Message Date
Sergey Biryukov
6b7a708fa1 Tests: Correct the test for NOT BETWEEN comparison operator in WP_Date_Query.
Follow-up to [29793].

Props patopaiar, jrf.
See #39265, #51802.

git-svn-id: https://develop.svn.wordpress.org/trunk@50276 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-09 18:08:07 +00:00
John Blackbourn
b4f354d524 Build/Test Tools: Various docblock improvements within test utilities.
See #51802


git-svn-id: https://develop.svn.wordpress.org/trunk@50265 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-09 13:22:47 +00:00
Robert Anderson
385c29b49a Fix wp.i18n.isRTL()
Fixes a bug causing wp.i18n.isRTL() to return false in RTL langauges by manually
loading the translated 'ltr' string for the i18n dependency. This ports over an
identical fix that was made in Gutenberg.

Fixes #52441.
Props @jonsurrell @youknowriad.


git-svn-id: https://develop.svn.wordpress.org/trunk@50259 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-08 23:49:33 +00:00
Sergey Biryukov
73b353ef95 Privacy: Rename the $send_confirmation_email parameter of wp_create_user_request() to $status, for clarity.
Follow-up to [50159], [50165].

Props xkon, TimothyBlynJacobs.
Fixes #52430. See #43890.

git-svn-id: https://develop.svn.wordpress.org/trunk@50230 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-05 15:48:59 +00:00
Jonathan Desrosiers
5629865595 Build/Test Tools: Fix tests after [50185].
This removes a test assertion defending against version ranges in the `node` value in `package.json` files. This is now supported.

Props peterwilsoncc.
See #52341.

git-svn-id: https://develop.svn.wordpress.org/trunk@50192 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-05 03:36:26 +00:00
Anthony Burchell
422c2c4ad2 Taxonomy: Add filter for post statuses when updating term count.
This adds a filter that allows `$post_statuses` to be modified in term count.

Props GunGeekATX, adamsilverstein, davecpage, nwjames, hellofromTonya, audrasjb, peterwilsoncc, TimothyBlynJacobs.
Fixes #38843.


git-svn-id: https://develop.svn.wordpress.org/trunk@50169 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 21:04:58 +00:00
Adam Silverstein
d4b2126f07 Security: add Content-Security-Policy script loaders.
Add new functions `wp_get_script_tag`, `wp_print_script_tag`, `wp_print_inline_script_tag` and `wp_get_inline_script_tag` that support script attributes. Enables passing attributes such as `async` or `nonce`, creating a path forward for enabling a Content-Security-Policy in core, plugins and themes.

Props tomdxw, johnbillion, jadeddragoon, jrchamp, mallorydxw, epicfaace, alinod, enricocarraro, ocean90.
Fixes #39941.




git-svn-id: https://develop.svn.wordpress.org/trunk@50167 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 20:53:53 +00:00
Anthony Burchell
afb3ee8c5d Coding Standards: Fix spacing in test_pending_status_with_false_send_confirmation_email test.
Follow-up to [50159] adjusts alignment of the `$request_data` value.

See #43890.


git-svn-id: https://develop.svn.wordpress.org/trunk@50160 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 19:59:51 +00:00
Anthony Burchell
32395325e9 Privacy: Allow Admin to Skip e-mail confirmation for Export.
This adds a form option to skip the admin email alert when exporting personal data.

Props xkon, azaozz, TZ-Media, iandunn, desrosj, iprg, allendav, wesselvandenberg, karmatosed, birgire, davidbaumwald, estelaris, paaljoachim, hellofromTonya.
Fixes #43890.


git-svn-id: https://develop.svn.wordpress.org/trunk@50159 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 19:43:37 +00:00
Timothy Jacobs
032e946633 REST API: Allow for the posts endpoint include/exclude terms query to include_children.
For example the `categories` or `categories_exclude` parameters can now optionally accept an object with a `terms` property that accepts the list of term ids and a new `include_children` property which controls the Tax Query `include_children` field.

Props jason_the_adams, jnylen0, birgire, dlh.
Fixes #39494.


git-svn-id: https://develop.svn.wordpress.org/trunk@50157 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 19:23:08 +00:00
Sergey Biryukov
051c135c6e General: Remove admin and login exceptions for https in get_home_url().
Previously, `get_home_url()` would automatically switch to `https` if the current request is already `https`, but would only do so on the front end.

This addresses the inconsistent behavior of returning different values in the admin and on the frontend.

Follow-up to [12598], [21937], [24844].

Props herregroen, mukesh27.
Fixes #52421.

git-svn-id: https://develop.svn.wordpress.org/trunk@50156 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 19:01:18 +00:00
Timothy Jacobs
7f049d3ac1 REST API: Return detailed error information from request validation.
Previously, only the first error message for each parameter was made available. Now, all error messages for a parameter are concatenated. Additionally, the detailed error for each parameter is made available in a new `details` section of the validation error. Each error is formatted following the standard REST API error formatting.

The `WP_REST_Server::error_to_response` method has been abstracted out into a standalone function `rest_convert_error_to_response` to allow for reuse by `WP_REST_Request`. The formatted errors now also contain an `additional_data` property which contains the additional error data provided by `WP_Error::get_all_error_data`.

Props dlh, xkon, TimothyBlynJacobs.
Fixes #46191.


git-svn-id: https://develop.svn.wordpress.org/trunk@50150 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 17:26:06 +00:00
John Blackbourn
75d2020f3f Cron API: Introduce a $wp_error parameter to functions that write to the cron array.
This allows the functions to return a `WP_Error` object containing more information in case of a problem, instead of just boolean false.

The various `pre_` filters in these functions are also updated so they can return or be passed a `WP_Error` object.

Fixes #49961


git-svn-id: https://develop.svn.wordpress.org/trunk@50143 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 13:47:46 +00:00
Robert Anderson
6df51a3fc7 Editor: Update @wordpress npm packages
Update @wordpress npm packages to the latest published versions. This means that
the block editor includes functionality that exists in Gutenberg 9.9.

Fixes #52334.


git-svn-id: https://develop.svn.wordpress.org/trunk@50137 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 05:14:46 +00:00
Peter Wilson
553d618e4a Canonical: Prevent ID enumeration of private post slugs.
Add check to `redirect_canonical()` to ensure private posts only redirect for logged in users.

Modifies the `read_post` mata capability to user `get_post_status()` rather than the post's `post_status` property to allow attachments to redirect based on the inherited post status.

Introduces `wp_force_ugly_post_permalink()` to unify the check to determine if an ugly link should be displayed in each of the functions used for determining permalinks: `get_permalink()`, `get_post_permalink()`, `_get_page_link()` and `get_attachment_link()`.

Improves logic of `get_attachment_link()` to validate parent post and resolution of inherited post status. This is an incomplete fix of #52373 to prevent the function returning links resulting in a file not found error. Required to unblock this ticket.

Props peterwilsoncc, TimothyBlynJacobs.
See #52373.
Fixes #5272.


git-svn-id: https://develop.svn.wordpress.org/trunk@50132 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 00:38:40 +00:00
flixos90
051aa92e3d Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.

This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.

* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
    * A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
    * The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
    * The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
    * For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
    * A new `wp_update_urls_to_https()` function takes care of the update routine.
    * A new `update_https` meta capability is introduced to control access.
    * If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
    * A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
    * A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.

Props flixos90, timothyblynjacobs.
Fixes #51437.


git-svn-id: https://develop.svn.wordpress.org/trunk@50131 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-02 00:08:01 +00:00
Peter Wilson
4cfbf629ca Posts, Post Types: Additional functions to check if a post is publicly viewable.
Introduces `is_post_status_viewable()` as a sibling to `is_post_type_viewable()`. Internal and protected statuses are never considered viewable. For built in posts statuses the `public` attribute is checked, for custom statuses the `publicly_queryable` attribute is checked.

Introduces `is_post_publicly_viewable()` for determining if an individual post can be viewed by logged out users. A post is considered viewable if both `is_post_status_viewable()` and `is_post_type_viewable()` return `true` for the post's attributes.

Additionally modifies `is_post_type_viewable()` to return `false` if an unregistered post type is passed to the function to avoid attempting to access properties on a non-object.

Props peterwilsoncc, SergeyBiryukov, whyisjake, TimothyBlynJacobs.
Fixes #49380.



git-svn-id: https://develop.svn.wordpress.org/trunk@50130 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-01 23:31:54 +00:00
John Blackbourn
729bb10f31 Posts, Post Types: Introduce new functions for determining if a post has a parent (has_post_parent()) and to fetch the post parent (get_post_parent()).
These functions are simple but reduce the logic needed in themes and plugins.

Props ramiy, sebastian.pisula, birgire, audrasjb, xkon

Fixes #33045


git-svn-id: https://develop.svn.wordpress.org/trunk@50127 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-01 21:20:44 +00:00
Anthony Burchell
f7d3dca48c REST API, Media: Add batch image editing endpoints.
Introduces new endpoints to allow for batch image editing using the REST API. 

The new endpoints can take an array of modifiers that will be applied in the order they appear.

Props ajlende, TimothyBlynJacobs, hellofromTonya, Mista-Flo.
Fixes #52192.


git-svn-id: https://develop.svn.wordpress.org/trunk@50124 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-01 18:35:38 +00:00
Sergey Biryukov
b6a04b3b28 Editor: Introduce a dynamic filter for the content of a single block:
`render_block_{$this->name}`

This complements the existing `render_block` hook and allows for filtering the content of a specific block without having to use conditionals inside the filter callback.

Props manzoorwani.jk, noisysocks, birgire, johnbillion.
Fixes #46187.

git-svn-id: https://develop.svn.wordpress.org/trunk@50123 602fd350-edb4-49c9-b593-d223f7449a82
2021-02-01 18:04:36 +00:00
Timothy Jacobs
c8f974f2f5 App Passwords: Introduce fine grained capabilities.
Previously, all permission checks for using app passwords were implemented using `edit_user`. This commit introduces a series of more fine grained meta capabilities that should be used instead: `create_app_password`, `list_app_passwords`, `read_app_password`, `edit_app_password`, `delete_app_password` and `delete_app_passwords`. These capabilities all map to `edit_user` by default, but may now be customized by developers.

Props johnbillion, TimothyBlynJacobs.
Fixes #51703.


git-svn-id: https://develop.svn.wordpress.org/trunk@50114 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-31 19:02:30 +00:00
John Blackbourn
dad20f8424 Comments: Fix a coding standards issue introduced in [50109].
See #33717


git-svn-id: https://develop.svn.wordpress.org/trunk@50113 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-31 18:16:35 +00:00
John Blackbourn
e978de5a8d Comments: Introduce a method for commenters to opt-in to receiving an email notification when their moderated comment gets approved.
The opt-in form is shown after the comment is submitted and held for moderation.

Sorry this took five years.

Props jeffr0, swissspidy, mrahmadawais, wonderboymusic, jdgrimes, obenland, Monika, imath, garrett-eclipse, johnbillion

Fixes #33717


git-svn-id: https://develop.svn.wordpress.org/trunk@50109 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-31 12:48:24 +00:00
Felix Arntz
986ebd436e Robots: Add max-image-preview:large directive by default.
This changeset introduces a `wp_robots_max_image_preview_large()` function which is hooked into the `wp_robots` filter to include the `max-image-preview:large` directive for all sites which are configured to be indexed by search engines. The directive allows search engines to display large image previews for the site in search results.

Props adamsilverstein, Clorith, flixos90, helen, joostdevalk, tweetythierry, westonruter.
Fixes #51511.


git-svn-id: https://develop.svn.wordpress.org/trunk@50078 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-29 20:36:03 +00:00
Felix Arntz
afdb88e9cf Security: Allow short-circuiting the wp_update_https_detection_errors() process.
This changeset introduces a `pre_wp_update_https_detection_errors` filter which can be used to short-circuit the default logic for detecting problems with HTTPS support for the site, by returning a `WP_Error` object.

Props timothyblynjacobs.
See #47577.


git-svn-id: https://develop.svn.wordpress.org/trunk@50075 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-29 19:58:39 +00:00
Felix Arntz
4e0bc3bc93 Security, Site Health: Improve accuracy in messaging about HTTPS support.
Following up on [49904], this changeset focuses mainly on improving the guidance about the current state of HTTPS in Site Health.

* Correct the existing copy to indicate that both the Site Address and the WordPress Address need to be changed to fully switch to HTTPS.
* Link to the respective input fields via anchor links rather than to the overall General Settings screen.
* Show different copy if the site is using HTTPS for the WordPress Address (for example to have only the administration panel in HTTPS), but not for the Site Address.
* Inform the user about potential problems even when the site is already using HTTPS, for example if the SSL certificate was no longer valid.
* Always rely on fresh information for determining HTTPS support issues in Site Health, and therefore change the `https_status` test to become asynchronous.
* Rename the new private `wp_is_owned_html_output()` function to a more appropriate `wp_is_local_html_output()`.

Props adamsilverstein, flixos90, johnjamesjacoby, timothyblynjacobs.
See #47577.


git-svn-id: https://develop.svn.wordpress.org/trunk@50072 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-29 19:09:49 +00:00
Timothy Jacobs
e290a9b557 App Passwords: Introduce introspection endpoint.
This introduces a new endpoint, `wp/v2/users/me/application-passwords/introspect`, that will return details about the App Password being used to authenticate the current request. This allows for an application to disambiguate between multiple installations of their application which would all share the same `app_id`.

Props xkon, peterwilsoncc, TimothyBlynJacobs.
Fixes #52275.


git-svn-id: https://develop.svn.wordpress.org/trunk@50065 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-29 00:05:20 +00:00
Robert Anderson
bc405697b0 Editor: Update @wordpress npm packages
Update @wordpress npm packages to the latest published versions. This means that
the block editor includes functionality that exists in Gutenberg 9.8.

See #52334.
Props isabel_brison.


git-svn-id: https://develop.svn.wordpress.org/trunk@50048 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-28 02:01:50 +00:00
Jake Spurlock
a76f895146 Privacy: Ensure that exported user data reports can't be found with directory listings.
By moving from `.html` to `.php` files, we can prevent directory listings, and ensure that WordPress can load.

Fixes #52299.

Props lucasbustamante, xkon, freewebmentor, SergeyBiryukov, whyisjake. 


git-svn-id: https://develop.svn.wordpress.org/trunk@50037 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-27 23:45:29 +00:00
Timothy Jacobs
e1c98a744b App Passwords: Improve validation and sanitization of the application name.
Application names are now required to be unique and cannot contain solely whitespace characters. Additionally, invalid characters are now stripped from the application name using `sanitize_text_field()`.

Props Boniu91, hellofromTonya, engahmeds3ed, xkon, francina.
Fixes #51941.


git-svn-id: https://develop.svn.wordpress.org/trunk@50030 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-27 19:03:42 +00:00
John Blackbourn
6df02a9ce2 REST API: Introduce modified_before and modified_after query parameters for the posts endpoints.
These parameters work just the same as `before` and `after` except they operate on the post modified date instead of the post published date.

Props claytoncollie, TimothyBlynJacobs, hellofromTonya

Fixes #50617


git-svn-id: https://develop.svn.wordpress.org/trunk@50024 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-26 18:26:13 +00:00
Gary Pendergast
ee4c2cf322 Menus: Fix linting errors introduced in [50013].
Props TimothyBlynJacobs.
Fixes #52189.



git-svn-id: https://develop.svn.wordpress.org/trunk@50014 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-25 06:53:43 +00:00
Gary Pendergast
6840112825 Menus: Make use of wp_resolve_post_date() when updating menu items.
This allows a menu item `post_date` to be set to particular value, rather than only allowing it to be set to "now". In particular, the WordPress Importer can use this to perform faster, more accurate duplicate checks.

Props jmdodd.
Fixes #52189.



git-svn-id: https://develop.svn.wordpress.org/trunk@50013 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-25 01:22:06 +00:00
Gary Pendergast
e2bb95aa50 Posts: Create a new function for resolving the post date.
`wp_insert_post()` has a few checks using `post_date` and `post_date_gmt`, to determine the correct post date. This functionality is now extracted out into a new `wp_resolve_post_date()` function, allowing the checks to be reused elsewhere.

Props jmdodd.
Fixes #52187.



git-svn-id: https://develop.svn.wordpress.org/trunk@50012 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-25 01:06:25 +00:00
Timothy Jacobs
0ceee0f871 REST API: Support type coercion when validating the enum JSON Schema keyword.
Previously, the `enum` keyword was validated by perform a strict equality check. For `string` types this is generally ok, but it prevented using alternative types like `number` when rich type support isn't available.

Now the same level of type coercion/sanitization is applied when validating `enum` as all other validation checks. This means that a value of `"1"` will be accepted for an `enum` of `[ 0, 1 ]`. Additionally, `object` types now properly ignore key order when checking for equality.

Props yakimun.
Fixes #51911.


git-svn-id: https://develop.svn.wordpress.org/trunk@50010 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-24 16:50:39 +00:00
Timothy Jacobs
15c8166424 REST API: Add more specific error codes for schema validation.
Previously, the majority of JSON Schema validation errors returned a generic `rest_invalid_param` error code. In preparation for #46191, where the underlying validation error code will be exposed, this commit adds specific error codes for each failure scenario.

Fixes #52317.


git-svn-id: https://develop.svn.wordpress.org/trunk@50007 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-24 03:57:39 +00:00
Timothy Jacobs
bb395706f4 REST API: Support embedding links in rest_preload_api_request().
Props lpawlik, spacedmonkey.
Fixes #51722.


git-svn-id: https://develop.svn.wordpress.org/trunk@50005 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-23 23:25:40 +00:00
Sergey Biryukov
c145ff4a1a 5.7-alpha-50000 🎉🙌❤️
Thank you for the past
Excited for the future
We are #WordPressStrong!

git-svn-id: https://develop.svn.wordpress.org/trunk@50000 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-21 12:37:39 +00:00
Felix Arntz
176a1f53f0 Robots: Introduce Robots API.
This changeset introduces a filter-based Robots API, providing central control over the `robots` meta tag.

* Introduces `wp_robots()` function which should be called anywhere a `robots` meta tag should be included.
* Introduces `wp_robots` filter which allows adding or modifying directives for the `robots` meta tag. The `wp_robots()` function is entirely filter-based, i.e. if no filter is added to `wp_robots`, no directives will be present, and therefore the entire `robots` meta tag will be omitted.
* Introduces the following `wp_robots` filter functions which replace similar existing functions that were manually rendering a `robots` meta tag:
    * `wp_robots_noindex()` replaces `noindex()`, which has been deprecated.
    * `wp_robots_no_robots()` replaces `wp_no_robots()`, which has been deprecated.
    * `wp_robots_sensitive_page()` replaces `wp_sensitive_page_meta()`, which has been deprecated. Its rendering of the `referrer` meta tag has been moved to another new function `wp_strict_cross_origin_referrer()`.

Migration to the new functions is straightforward. For example, a call to `add_action( 'wp_head', 'wp_no_robots' )` should be replaced with `add_filter( 'wp_robots', 'wp_robots_no_robots' )`.

Plugins and themes that render their own `robots` meta tags are encouraged to switch to rely on the `wp_robots` filter in order to use the central management layer now provided by WordPress core.

Props adamsilverstein, flixos90, timothyblynjacobs, westonruter.
See #51511.


git-svn-id: https://develop.svn.wordpress.org/trunk@49992 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-21 01:35:16 +00:00
Peter Wilson
56939ff70e Media: Ensure get_post_status() returns correct result for attachments.
Prevent `get_post_status()` returning `false` for attachments if the parent post has been deleted. The returned attachment post status is now passed through the `get_post_status` filter.

Add tests for `get_post_status()`.

Props peterwilsoncc, timothyblynjacobs for review.
Fixes #52326.



git-svn-id: https://develop.svn.wordpress.org/trunk@49985 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-20 04:39:24 +00:00
Greg Ziółkowski
f84ebe3fe7 Blocks: Add automatic RTL handlind for block styles registered from metadata
Related Gutenberg issue: https://github.com/WordPress/gutenberg/pull/28274

With this change it is going to be possible to use the same pattern that wp_style_add_data uses for RTL handling. If the block style file with "-rtl.css" is included in addition to the regular style referenced in "block.json" file then it is going to be automatically registered.

Props swisspidy, aristath.
See #52301.



git-svn-id: https://develop.svn.wordpress.org/trunk@49982 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-19 11:48:59 +00:00
Greg Ziółkowski
edd77c0791 Blocks: Add i18n support to register_block_type_from_metadata
Related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/23636.
Related WP-CLI PR: https://github.com/wp-cli/i18n-command/pull/210.
Related documentation proposal: https://github.com/WordPress/gutenberg/blob/master/docs/designers-developers/developers/block-api/block-metadata.md#internationalization-not-implemented

Adds programatic i18n support to `register_block_type_from_metadata` function for block settings registered from `block.json` file that provides `textdomain` field.


Props swissspidy, ocean90.
Fixes #52301.



git-svn-id: https://develop.svn.wordpress.org/trunk@49981 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-19 11:04:03 +00:00
Peter Wilson
5582e4965c Tests: Remove references to post status public.
Replace invalid post status `public` with the valid status `publish`.

See #51802.



git-svn-id: https://develop.svn.wordpress.org/trunk@49974 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-18 03:26:29 +00:00
SergeyBiryukov
6e98255975 Privacy: Update unit test files missed in [49970].
See #51849.

git-svn-id: https://develop.svn.wordpress.org/trunk@49971 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 17:48:01 +00:00
Timothy Jacobs
244e4d4e63 REST API: Allow sending an empty array to delete multi meta keys.
Previously, only `null` was supported.

Fixes #50790.
Props chrisvanpatten.


git-svn-id: https://develop.svn.wordpress.org/trunk@49966 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-17 00:49:39 +00:00
Sergey Biryukov
c8c248e967 Tests: Set up the plugin download in multisite plugin tests to come locally.
This brings consistency between single site and multisite in REST API plugin installation tests.

Previously, multisite tests were unnecessarily downloading the plugin from WordPress.org on each test run, causing external HTTP requests and leading to failures in case of a timeout.

Follow-up to [48242], [49491], [49913].

See #51669.

git-svn-id: https://develop.svn.wordpress.org/trunk@49951 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-09 05:56:04 +00:00
Greg Ziółkowski
bb01f0187c Editor: Support filtering arguments in block type registration from metadata
Adds 2 new hooks in `register_block_type_from_metadata`:

- Named `block_type_metadata` to filter the content of metadata read from `block.json`
- Named `block_type_metadata_settings` to filter the settings object determined from the metadata that is passed to `register_block_type` call

Props swissspidy.
Fixes #52138.



git-svn-id: https://develop.svn.wordpress.org/trunk@49948 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 16:43:29 +00:00
John Blackbourn
cf68c90021 Taxonomy: Correct and clarify documentation for the return types of term query functions.
See #51800, #38266


git-svn-id: https://develop.svn.wordpress.org/trunk@49947 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-08 15:22:17 +00:00
Peter Wilson
429c7b8ddc Tests: Increase use of shared fixtures in capability checks.
See #51802.


git-svn-id: https://develop.svn.wordpress.org/trunk@49932 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-04 23:32:49 +00:00
Timothy Jacobs
69cc6e61d0 REST API: Expose all themes in the themes controller.
Previously, only the active theme was made available. This commit allows for all themes to be queried if the user has the `switch_themes` or `manage_network_themes` capabilities.

This commit also no longer exposes the `page`, `per_page`, `search` and `context` query parameters since they are not supported by this controller.

Props spacedmonkey, lpawlik, TimothyBlynJacobs.
Fixes #50152.


git-svn-id: https://develop.svn.wordpress.org/trunk@49925 602fd350-edb4-49c9-b593-d223f7449a82
2021-01-03 21:45:42 +00:00