Commit Graph

569 Commits

Author SHA1 Message Date
Joe McGill 04a88b9941 Grouped backports to the 5.8 branch.
- REST API: Limit `search_columns` for users without `list_users`.
- Comments: Prevent users who can not see a post from seeing comments on it.
- Application Passwords: Prevent the use of some pseudo protocols in application passwords.
- Restrict media shortcode ajax to certain type
- REST API: Ensure no-cache headers are sent when methods are overriden.
- Prevent unintended behavior when certain objects are unserialized.

Merges [56833], [56834], [56835], [56836], [56837], and [56838] to the 5.8 branch.
Props xknown, jorbin, Vortfu, joehoyle, timothyblynjacobs, peterwilsoncc, ehtis, tykoted, martinkrcho, paulkevan, dd32, antpb, rmccue.

Built from https://develop.svn.wordpress.org/branches/5.8@56884


git-svn-id: http://core.svn.wordpress.org/branches/5.8@56395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-12 18:30:41 +00:00
audrasjb d8ffe4fe33 Grouped backports to the 5.8 branch.
- Editor: Bump @wordpress packages for the 5.9 branch,
- Media: Refactor search by filename within the admin,
- REST API: Lockdown post parameter of the terms endpoint,
- Customize: Escape blogname option in underscores templates,
- Query: Validate relation in `WP_Date_Query`,
- Users: Revert use of shared objects for current user,
- Posts, Post types: Apply KSES to post-by-email content,
- General: Validate host on "Are you sure?" screen,
- Posts, Post types: Remove emails from post-by-email logs,
- Pings/trackbacks: Apply KSES to all trackbacks,
- Mail: Reset PHPMailer properties between use,
- Comments: Apply kses when editing comments,
- Widgets: Escape RSS error messages for display.

Merges [54521-54530] to the 5.8 branch.
Props audrasjb, costdev, cu121, dd32, davidbaumwald, ehtis, johnbillion, johnjamesjacoby, martinkrcho, matveb, oztaser, paulkevan, peterwilsoncc, ravipatel, SergeyBiryukov, talldanwp, timothyblynjacobs, tykoted, voldemortensen, vortfu, xknown.

Built from https://develop.svn.wordpress.org/branches/5.8@54548


git-svn-id: http://core.svn.wordpress.org/branches/5.8@54103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-17 17:48:01 +00:00
Sergey Biryukov 45f4c51ec4 Block Patterns: Update the value used for keywords.
Patterns on the [https://wordpress.org/patterns/ Pattern Directory] can have keywords for better discoverability while searching. The way these are stored [69548ff1f0 was changed from a taxonomy to meta value], but the `/wp/v2/pattern-directory/patterns` endpoint was still pulling from that old value.

The correct property to use for this field is `meta.wpop_keywords`, which returns a single string with comma-separated keywords.

Follow-up to [51021].

Props ryelle, TimothyBlynJacobs.
Merges [53665] to the 5.8 branch.
See #56126.
Built from https://develop.svn.wordpress.org/branches/5.8@53675


git-svn-id: http://core.svn.wordpress.org/branches/5.8@53234 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-06 16:28:01 +00:00
desrosj 94a93212ba Widgets: Prevent widgets unintentionally being moved to the inactive sidebar.
This fixes a bug where widgets are unintentionally moved to the `wp_inactive_widgets` sidebar when batch updates occur through the REST API.

When batch requests are processed, only `$_wp_sidebars_widgets` is updated by previous calls to `WP_REST_Widgets_Controller::create_item()`. `$sidebars_widgets` is not aware of the new widget’s intended location, and `retrieve_widgets()` mistakenly flags the widget as inactive.

Calling `wp_get_sidebars_widgets()` before `retrieve_widgets()` ensures both global variables match and is intended as a temporary fix until the root cause of the problem can be fixed.

Props zieladam, htmgarcia, timothyblynjacobs.
Merges [51432] to the 5.8 branch.
Fixes #53657.
Built from https://develop.svn.wordpress.org/branches/5.8@51439


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-15 15:42:58 +00:00
desrosj 7523e1376b Widgets: Use `wp_sidebar_description()` to retrieve a sidebar’s description.
This switches `WP_REST_Sidebars_Controller` to use `wp_sidebar_description()` for retrieving the description of a given sidebar instead of referencing the value in the `$wp_registered_sidebars` global variable directly.

`wp_sidebar_description()` uses `wp_kses()` to only allow the default list of `$allowed_tags` to be present in a sidebar’s description.

Props timothyblynjacobs, desrosj, SergeyBiryukov.
Merges [51408] to the 5.8 branch.
Fixes #53646.
Built from https://develop.svn.wordpress.org/branches/5.8@51412


git-svn-id: http://core.svn.wordpress.org/branches/5.8@51023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-13 00:10:58 +00:00
desrosj 54a19b3fb9 REST API: Ensure a sidebar's widgets property is a list.
When a widget is removed from a sidebar, if it was removed from the middle of the list, the widgets property would become an object with numeric keys.

The sidebars controller now forces the widgets property to be a list.

Props walbo, timothyblynjacobs.
Merges [51377] to the 5.8 branch.
Fixes #53612.
Built from https://develop.svn.wordpress.org/branches/5.8@51385


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50996 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-09 01:00:56 +00:00
desrosj 636f00b5f2 REST API: Add the `$request` parameter to methods checking permissions.
This adds the `$request` parameter to the permissions_check() methods within `WP_REST_Widgets_Controller` and adds $request as an allowed parameter to the `permissions_check()` method within `WP_REST_Templates_Controller`.

Even when this parameter is not used by default, it should be implemented to support the class being extended and the method overridden.

Props johnbillion, timothyblynjacobs.
Merges [51349] to the 5.8 branch.
Fixes #53593.
Built from https://develop.svn.wordpress.org/branches/5.8@51350


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50959 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 15:56:59 +00:00
desrosj aacf626adf Docs: Remove an empty line between `@param` and `@return` tags in some newly added REST API methods, per the documentation standards.
Follow-up to [48242], [49925], [51003], [51021].

Props SergeyBiryukov.
Merges [51289] to the 5.8 branch.
See #52628, #53461.
Built from https://develop.svn.wordpress.org/branches/5.8@51317


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 19:04:56 +00:00
desrosj f51b2d6845 Docs: List the expected type first instead of `WP_Error` in some REST API methods added in 5.8.
Follow-up to [46696], [49929], [50995], [51021].

Props SergeyBiryukov.
Merges [51286] to the 5.8 branch.
See #52628, #53461.
Built from https://develop.svn.wordpress.org/branches/5.8@51316


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 19:03:57 +00:00
desrosj 20b93039f3 Docs: Add missing `@since` tags for some REST API methods added in 5.8.
Follow-up to [50995], [51021].

Props SergeyBiryukov.
Merges [51280] to the 5.8 branch.
See #52628, #53461.
Built from https://develop.svn.wordpress.org/branches/5.8@51311


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 18:55:00 +00:00
desrosj 8d871746a4 Docs: Document the globals used in `WP_REST_Widget_Types_Controller` and `WP_REST_Widgets_Controller`.
Follow-up to [50995].

Props SergeyBiryukov.
Merges [51279] to the 5.8 branch.
See #52628, #53461.
Built from https://develop.svn.wordpress.org/branches/5.8@51310


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-02 18:53:00 +00:00
desrosj fe3ecbcade Docs: Correct documentation for `rest_{$post_type}_query and `rest_{$taxonomy}_query` filters.
Synchronize documentation for related `rest_{$object_type}_query` filters for consistency.

Props dlh.
Merges [51293] to the 5.8 branch.
Fixes #53568.
Built from https://develop.svn.wordpress.org/branches/5.8@51295


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 18:51:02 +00:00
desrosj 337cfb97c1 REST API: Allow multiple widgets to be deleted in a single batch request.
This resets the `WP_Widget::$updated` flag when deleting a widget, to avoid blocking all future updates in a request.

Props noisysocks, andraganescu.
Merges [51277] to the 5.8 branch.
Fixes #53557.
Built from https://develop.svn.wordpress.org/branches/5.8@51290


git-svn-id: http://core.svn.wordpress.org/branches/5.8@50899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-30 18:47:01 +00:00
noisysocks 7131a90b0a Widgets REST API: Fix non-multi widgets not appearing in wp_inactive_widgets
Registered widgets that do not extend WP_Widget should appear in the
wp_inactive_widgets sidebar by default. Having the widgets REST API call
retrieve_widgets() before serving any request ensures that this will happen.

This is a similar fix to [51235].

Fixes #53534.
Props zieladam, timothyblynjacobs.

Built from https://develop.svn.wordpress.org/trunk@51248


git-svn-id: http://core.svn.wordpress.org/trunk@50857 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-28 04:34:57 +00:00
youknowriad be0d5b2534 Block Editor: Update the packages with a number of fixes targeted for Beta 4.
It includes fixes from these two backport PRs: 

 - https://github.com/WordPress/gutenberg/pull/32992
 - https://github.com/WordPress/gutenberg/pull/32956

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

Built from https://develop.svn.wordpress.org/trunk@51241


git-svn-id: http://core.svn.wordpress.org/trunk@50850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:52:22 +00:00
desrosj 49a6a14915 REST API: Include the sidebar ID when saving a widget.
This ensures backwards compatibility for code expecting this field to be present.

Props strategio, noisysocks, spacedmonkey.
See #53452.
Built from https://develop.svn.wordpress.org/trunk@51239


git-svn-id: http://core.svn.wordpress.org/trunk@50848 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 15:25:59 +00:00
TimothyBlynJacobs dc710243a3 REST API: Retrieve latest widgets before loading sidebars.
This fixes issues where sidebars would be unexpectedly missing from the new widgets screen. Running retrieve_widgets syncs sidebars that were registered after the last theme switch.

Props walbo, hellofromTonya, noisysocks.
Fixes #53489.

Built from https://develop.svn.wordpress.org/trunk@51235


git-svn-id: http://core.svn.wordpress.org/trunk@50844 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-25 13:18:58 +00:00
desrosj fd27b43fba Coding Standards: Apply an alignment fix from running `composer format`.
Follow up to [51216].
See #53481.
Built from https://develop.svn.wordpress.org/trunk@51229


git-svn-id: http://core.svn.wordpress.org/trunk@50838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-24 19:25:58 +00:00
desrosj fccc020d29 Docs: Various docblock corrections for code added in 5.8.
Props johnbillion.
See #53461.
Built from https://develop.svn.wordpress.org/trunk@51221


git-svn-id: http://core.svn.wordpress.org/trunk@50830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 19:05:57 +00:00
noisysocks 0bf96b88d3 Widgets: Fix widget preview not working if widget registered via a instance
The register_widget function can be called with a class name or a class
instance. Once called with a class instance, the class instance is converted to
hash as used key in array.

Props spacedmonkey, zieladam.

Built from https://develop.svn.wordpress.org/trunk@51216


git-svn-id: http://core.svn.wordpress.org/trunk@50825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 01:34:58 +00:00
desrosj 48e31b23f5 Docs: Shorten the copyright notice for the `WP_REST_Sidebars_Controller` class.
The class has been heavily modified from the original source, so the copyright can be modified to simply reference the original author’s work. The carry forward of the copyright and original code is implied.

Follow up to [50993-50995,51007,51020,51029].

Props SergeyBiryukov, cbringmann, chanthaboune, desrosj.
Fixes #41683.
Built from https://develop.svn.wordpress.org/trunk@51210


git-svn-id: http://core.svn.wordpress.org/trunk@50819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-22 23:05:58 +00:00
iandunn 479e9847ed Block Editor: Move caching to endpoint for unique responses.
Now that the pattern API request includes the locale and version, the cache key needs to contain a hash of the query args.

Props ocean90, dd32, timothyblynjacobs
Fixes #53435

Built from https://develop.svn.wordpress.org/trunk@51208


git-svn-id: http://core.svn.wordpress.org/trunk@50817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-22 21:24:58 +00:00
iandunn 0f249041f9 Block Editor: Send locale, version with remote pattern requests.
This information is needed by the w.org API for translation and caching.

Props dd32, ryelle, tellyworth
See #53435

Built from https://develop.svn.wordpress.org/trunk@51206


git-svn-id: http://core.svn.wordpress.org/trunk@50815 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-22 21:21:57 +00:00
Sergey Biryukov 5f30098a1d REST API: Decode single and double quote entities in widget names and descriptions.
Follow-up to [51174], [51175].

Props ocean90, ramonopoly.
Fixes #53407.
Built from https://develop.svn.wordpress.org/trunk@51183


git-svn-id: http://core.svn.wordpress.org/trunk@50792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-18 15:52:56 +00:00
Sergey Biryukov 29ba355256 Coding Standards: Fix WPCS issue in [51174].
See #53407.
Built from https://develop.svn.wordpress.org/trunk@51175


git-svn-id: http://core.svn.wordpress.org/trunk@50784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-17 11:33:58 +00:00
Sergey Biryukov 9f1145b8ae REST API: Decode HTML entities in widget names and descriptions in widget types controller.
Follow-up to [50995].

Props ramonopoly, noisysocks, spacedmonkey, justinahinon, audrasjb, SergeyBiryukov.
Fixes #53407.
Built from https://develop.svn.wordpress.org/trunk@51174


git-svn-id: http://core.svn.wordpress.org/trunk@50783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-17 11:30:00 +00:00
desrosj ef4b42b03b Coding Standards: Apply an alignment fix.
Follow up to [51021].

See #53246.
Built from https://develop.svn.wordpress.org/trunk@51093


git-svn-id: http://core.svn.wordpress.org/trunk@50702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-08 13:22:57 +00:00
Sergey Biryukov 47231831f7 REST API: Restore the `$creating` parameter of `rest_after_save_widget` action.
This is consistent with other similar REST API actions.

Partially reverts [51071], except for DocBlock formatting fixes.

Props TimothyBlynJacobs.
See #53317.
Built from https://develop.svn.wordpress.org/trunk@51074


git-svn-id: http://core.svn.wordpress.org/trunk@50683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-04 23:13:59 +00:00
Sergey Biryukov 36cf03ca52 REST API: Rename the `$creating` parameter of `rest_after_save_widget` action to `$update`.
This brings some consistency with similar actions for posts, e.g. `save_post` or `wp_insert_post`.

Follow-up to [51068], [51069].

See #53317.
Built from https://develop.svn.wordpress.org/trunk@51071


git-svn-id: http://core.svn.wordpress.org/trunk@50680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-04 10:48:56 +00:00
noisysocks 222541d7c3 REST API: Delete fresh_site option when updating widgets via REST API
Adds new hooks (rest_save_sidebar, rest_delete_widget, rest_after_save_widget)
to the widgets REST API and uses them to delete the fresh_site option when
updating widgets via the REST API. This ensures that starter content isn't
loaded in the Customizer after a user makes changes.

Fixes #53317.
Props kevin940726, garrett-eclipse, andraganescu, hellofromtonya.

Built from https://develop.svn.wordpress.org/trunk@51068


git-svn-id: http://core.svn.wordpress.org/trunk@50677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-04 00:45:56 +00:00
noisysocks 5162c8e6a8 REST API: Add 'delete_widget' action to delete widget endpoint
Triggers the 'delete_widget' action to the delete widget endpoint in the REST
API. This aligns with the behaviour in the widgets WP Admin screen.

Fixes #53289.
Props isabel_brison, TimothyBlynJacobs.

Built from https://develop.svn.wordpress.org/trunk@51060


git-svn-id: http://core.svn.wordpress.org/trunk@50669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-02 01:40:57 +00:00
noisysocks 2fd3f23408 REST API: Fix delete widget endpoint
Makes the `DELETE /wp/v2/widgets/:id?force=1` endpoint actually delete the
widget from the `"widget-$id_base"` option and not just remove it from
`'sidebars_widgets'`.

Fixes #53313.
Props TimothyBlynJacobs.

Built from https://develop.svn.wordpress.org/trunk@51059


git-svn-id: http://core.svn.wordpress.org/trunk@50668 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-02 01:22:57 +00:00
TimothyBlynJacobs f3504cd945 REST API: Remove duplicates in the widget types endpoint.
Props noisysocks, spacedmonkey, imath, isabel_brison.
Fixes #53305.

Built from https://develop.svn.wordpress.org/trunk@51049


git-svn-id: http://core.svn.wordpress.org/trunk@50658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-31 20:57:58 +00:00
TimothyBlynJacobs cc26123e20 REST API: Add support for modifying the term relation when querying posts.
By default, a post most contain any of the requested terms to be included in the response. This commit adds a new `operator` property that can be set to `AND` to require a post to contain all of the requested terms.

For example, `/wp/v2/posts?tags[terms]=1,2,3&tags[operator]=AND` will return posts that have tags with the ids of 1, 2, and 3.

Props dlh, earnjam, Clorith, jnylen0, sebbb.
Fixes #41287.

Built from https://develop.svn.wordpress.org/trunk@51026


git-svn-id: http://core.svn.wordpress.org/trunk@50635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 02:16:59 +00:00
ryelle 56ca42b5d9 Block Editor: Add support for the pattern directory.
Add an endpoint for fetching block patterns from WordPress.org, and load the block patterns from this new API. Remove the block patterns that have already been moved to WordPress.org/patterns.

Props ryelle, iandunn, youknowriad, timothyblynjacobs.
Fixes #53246.


Built from https://develop.svn.wordpress.org/trunk@51021


git-svn-id: http://core.svn.wordpress.org/trunk@50630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 01:11:59 +00:00
youknowriad 4ae0e4220f Block Editor: Introduce block templates for classic themes.
With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

Built from https://develop.svn.wordpress.org/trunk@51003


git-svn-id: http://core.svn.wordpress.org/trunk@50612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 14:20:57 +00:00
Sergey Biryukov cc95428f75 REST API: Update “object” strings to use the appropriate nouns.
This updates route arguments and schema descriptions to use more specific object types for clarity.

Follow-up to [39342].

Props lephleg, jnylen0.
Fixes #40720.
Built from https://develop.svn.wordpress.org/trunk@51000


git-svn-id: http://core.svn.wordpress.org/trunk@50609 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 13:12:58 +00:00
noisysocks 1314542c50 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs, spacedmonkey, zieladam, jorgefilipecosta, youknowriad, kevin940726.

Built from https://develop.svn.wordpress.org/trunk@50995


git-svn-id: http://core.svn.wordpress.org/trunk@50604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:27:57 +00:00
noisysocks ed195fbd89 REST API: Revert widget endpoints
Reverts [50993] as it has missing props.

Reverts [50993].
See #41683.

Built from https://develop.svn.wordpress.org/trunk@50994


git-svn-id: http://core.svn.wordpress.org/trunk@50603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:22:56 +00:00
noisysocks 2a4e1e0c04 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs.

Built from https://develop.svn.wordpress.org/trunk@50993


git-svn-id: http://core.svn.wordpress.org/trunk@50602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 07:52:55 +00:00
Sergey Biryukov 1e02e0f049 Docs: Use 3-digit, x.x.x-style semantic versioning for two `_doing_it_wrong()` calls.
Follow-up to [37985], [38420], [39021].

See #52628.
Built from https://develop.svn.wordpress.org/trunk@50952


git-svn-id: http://core.svn.wordpress.org/trunk@50561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-22 13:09:56 +00:00
davidbaumwald 9cd6547f13 Docs: Update `help` key documentation link in REST API response.
Props dd32, mukesh27, audrasjb, SergeyBiryukov.
Fixes #53162.
Built from https://develop.svn.wordpress.org/trunk@50840


git-svn-id: http://core.svn.wordpress.org/trunk@50449 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-11 18:05:02 +00:00
Adam Silverstein 524030edfa Images: enable WebP support.
Add support for uploading, editing and saving WebP images when supported by the server.

Add 'image/webp' to supported mime types. Correctly identify WebP images and sizes even when PHP doesn't support WebP. Resize uploaded WebP files (when supported) and use for front end markup.

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.


Built from https://develop.svn.wordpress.org/trunk@50810


git-svn-id: http://core.svn.wordpress.org/trunk@50419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-04 14:44:58 +00:00
Sergey Biryukov 8cd601c8ba REST API: Check the results of `get_metadata()` in `WP_REST_Meta_Fields` methods.
This avoids PHP warnings in case the function returns boolean `false` instead of an array.

Props david.binda.
Fixes #53099.
Built from https://develop.svn.wordpress.org/trunk@50793


git-svn-id: http://core.svn.wordpress.org/trunk@50402 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-27 18:36:04 +00:00
desrosj e445660ee3 REST API: Allow authors to read their own password protected posts.
Allow authenticated users to read the contents of password protected posts if they have the `edit_post` meta capability for the post.

Props xknown, zieladam, peterwilsoncc, swissspidy, timothyblynjacobs.
Built from https://develop.svn.wordpress.org/trunk@50717


git-svn-id: http://core.svn.wordpress.org/trunk@50326 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-14 23:24:04 +00:00
Rachel Baker 3d04a220be REST API: Move the `rest_jsonp_enabled` filter before setting the Content-Type header.
Fixes an issue where if JSONP was disabled the `Content-Type` HTTP header was still set to `application/javascript`.  

Props dd32, TimothyBlynJacobs.
Fixes #52691.
Built from https://develop.svn.wordpress.org/trunk@50695


git-svn-id: http://core.svn.wordpress.org/trunk@50304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-09 21:28:08 +00:00
davidbaumwald 739dfb756f Coding Standards: Remove some extra whitespace in `get_item_schema`.
Introduced in [50527].

See #52627.
Built from https://develop.svn.wordpress.org/trunk@50632


git-svn-id: http://core.svn.wordpress.org/trunk@50244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-01 15:54:04 +00:00
Peter Wilson c41990398c REST API: Prevent database error when deleting meta data.
Add a check to `WP_REST_Meta_Fields::delete_meta_value()` ensuring meta data is set before attempting to delete it from the database. If the data does not exist, the delete is considered successful as the data matches the desired state.

Props BrechtVds, goaroundagain, TimothyBlynJacobs.
Fixes #52787.

Built from https://develop.svn.wordpress.org/trunk@50567


git-svn-id: http://core.svn.wordpress.org/trunk@50180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-23 23:36:04 +00:00
Sergey Biryukov cb55990e50 Docs: Add missing `@since` tags for `item_link` and `item_link_description` post type and taxonomy labels.
Follow-up to [50527].

See #52688.
Built from https://develop.svn.wordpress.org/trunk@50529


git-svn-id: http://core.svn.wordpress.org/trunk@50142 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-13 10:25:06 +00:00
gziolo f27c179afc Editor: Make block type aware of variations
Currently block variations are only defined on the client. In some cases, creating block variations on the server can be very useful, especially when needed data is not exposed in the REST APIs.

Related to https://github.com/WordPress/gutenberg/pull/29095.

Props: gwwar, timothyblynjacobs.
Fixes: #52688.


Built from https://develop.svn.wordpress.org/trunk@50527


git-svn-id: http://core.svn.wordpress.org/trunk@50140 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-12 13:35:09 +00:00