Commit Graph

3424 Commits

Author SHA1 Message Date
Jake Spurlock 6dba36e4ef Canonical: Add tests for trailing slashes for robots.txt.
See #48025.

Props Toro_Unit, joostdevalk, SergeyBiryukov.


git-svn-id: https://develop.svn.wordpress.org/trunk@48155 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-24 00:05:21 +00:00
Jake Spurlock ec062c08fe Comments: Allow `wp_update_comment()` to return `WP_Error()`.
The `wp_update_comment_data` filter introduced in 4.7 allows comment data to be filtered before it is updated in the database.

The patch aims to handle `WP_Error` as the filter above return value in a similar manner as is done for `wp_new_comment()`.


Fixes #39732.

Props: enricosorcinelli, swissspidy, gkloveweb, jnylen0, jbpaul17, afercia, SergeyBiryukov, audrasjb, imath, davidbaumwald.


git-svn-id: https://develop.svn.wordpress.org/trunk@48154 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-24 00:03:33 +00:00
Jake Spurlock 95b9933e64 Administration: Update `WP_List_Table::get_sortable_columns()` to support `asc` and `desc` arguments.
This makes the API a little more clear, whereas setting `false` used to mean `asc` and `true` meant `desc`, you can now use those directly, while maintaining back-compat.

Fixes #45089.

Props Tkama, SergeyBiryukov, shital-patel, desrosj, birgire, davidbaumwald. 



git-svn-id: https://develop.svn.wordpress.org/trunk@48151 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 23:13:35 +00:00
Greg Ziółkowski 5f6ab44340 Editor: Introduce new API method that register block from `block.json` metadata file
Backports changes added to Gutenberg in:
- https://github.com/WordPress/gutenberg/pull/20794
- https://github.com/WordPress/gutenberg/pull/22519
`register_block_type_from_metadata` function is going to be used to register all blocks on the server using `block.json` metadata files.

Props ocean90, azaozz, aduth, mcsf, jorgefilipecosta, spacedmonkey, nosolosw, swissspidy and noahtallen.
Fixes #50263.



git-svn-id: https://develop.svn.wordpress.org/trunk@48141 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 15:43:19 +00:00
Sergey Biryukov 0a301ec4b5 Docs: Use sentence case for comments in `tests/kses.php`, per the documentation standards.
Follow-up to [48132].

See #49464, #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48139 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 11:09:04 +00:00
Jake Spurlock 8368cc2b44 Embeds: Ensure that classic embed support works in the block editor.
See https://github.com/WordPress/gutenberg/pull/6345

Fixes #45447.

Props swisspidy, pento, audrasjb, aduth, jrchamp, thrijith, TimothyBlynJacobs, whyisjake. 
 


git-svn-id: https://develop.svn.wordpress.org/trunk@48135 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 06:06:11 +00:00
Jake Spurlock 7b08983ce4 Comments: Ensure the proper comment count and pages for unapproved comments.
Previiously, unapproved comments can alter the comment count, returning incorrect page numbers.

Fixes #8973.

Props GregMulhauser, dd32, ryan, mrmist, hakre, solarissmoke, billerickson, ericlewis, SergeyBiryukov, chriscct7, dossy, lukecavanagh, renggo888, jdorner, matjack1, pento, audrasjb, imath, davidbaumwald, whyisjake.  



git-svn-id: https://develop.svn.wordpress.org/trunk@48133 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 05:22:39 +00:00
Jake Spurlock 888421a924 Formatting: Extend `wp_kses_hair` and `wp_kses_hair_parse` to allow digits and underscores.
Fixes a lot of issues around parsing XML/HTML attributes.

Fixes #49464.

See #34406, #48608.

Props codeforest, zodiac1978, johnpgreen, dlh, ayeshrajans, johnpgreen, rilwis, travisnorthcutt, miqrogroove, chriscct7, whyisjake.


git-svn-id: https://develop.svn.wordpress.org/trunk@48132 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-23 05:05:57 +00:00
Jake Spurlock 800cfa8a82 Privacy: Use relative paths for exported personal data.
Ensures back-compat while moving to paths off of the /exports directory.

Fixes: #44038.

Props: allendav, mrTall, desrosj, garrett-eclipse, cameronamcintyre, nmenescardi, xkon, whyisjake, davidbaumwald.


git-svn-id: https://develop.svn.wordpress.org/trunk@48127 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 22:38:11 +00:00
Jonathan Desrosiers 517c27e297 Docs: Small inline documentation corrections following [48121].
Also, remove the `version` argument from the `wp.deprecated()` call in `password-strength-meter.js`. This argument is for specifying the version a feature will be removed, not when the feature was removed.

Props hareesh-pillai.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48124 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 19:07:57 +00:00
Jonathan Desrosiers e26394bb2d General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.

git-svn-id: https://develop.svn.wordpress.org/trunk@48121 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 17:24:34 +00:00
Greg Ziółkowski 9b2b8cad20 Editor: Remove default "layout" block attribute from WP_Block_Type::get_attributes
The merging behavior which assigns the `layout` attribute in `WP_Block_Type` gets removed.

Props aduth, TimothyBlynJacobs.
Fixes #50257.



git-svn-id: https://develop.svn.wordpress.org/trunk@48118 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 12:20:20 +00:00
Greg Ziółkowski 699c8557f9 Blocks: Add context fields to WP_Block_Type
New block context related fields were added as part of https://github.com/WordPress/gutenberg/pull/22686. This changest backports them to WP_Block_Type class.

Props aduth, spacedmonkey, mcsf, epiqueras.
Fixes #47656.  



git-svn-id: https://develop.svn.wordpress.org/trunk@48117 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-22 10:24:42 +00:00
Andrea Fercia 98d22d5d3d I18N: Restore the "Error:" prefix for error messages.
Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48115 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 13:58:46 +00:00
Sergey Biryukov e8176a19e2 Posts, Post Types: Avoid a PHP warning when `get_the_content()` is called outside of the loop.
This ensures that `$pages` and other globals are only used after they have been set up in `setup_postdata()`.

Follow-up to [44941].

Props tessawatkinsllc, dontdream, spacedmonkey, squarecandy, davidbaumwald, SergeyBiryukov.
Fixes #47824. See #42814.

git-svn-id: https://develop.svn.wordpress.org/trunk@48114 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 10:34:35 +00:00
Sergey Biryukov a7264f196d Posts, Post Types: Simplify `test_setup_postdata_loop()`.
The important part here is calling `the_content()` after setting up post data for another post without updating global `$post`.

The `foreach()` loop is not necessary.

Follow-up to [UT1289].

See #47824, #24330.

git-svn-id: https://develop.svn.wordpress.org/trunk@48113 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-21 10:28:52 +00:00
Sergey Biryukov c682da9190 Docs: Use a hyphen with the "non" prefix in a more consistent way.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48106 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-20 12:13:58 +00:00
John Blackbourn 1db25e3d38 Docs: Remove unnecessary variables names from `@return` tags.
See #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48100 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-19 22:53:54 +00:00
Adam Silverstein a1fd329682 Formatting: new filter `safecss_filter_attr_allow_css` on css parts.
Enables developers to determine whether a section of CSS should be allowed or discarded. By default, the value will be false if the part contains \ ( & } = or comments. Returning true allows the CSS part to be included in the output.

Replaces the `safe_style_disallowed_chars` filter introduced in r47891.

Props azaozz.
Fixes #37134.



git-svn-id: https://develop.svn.wordpress.org/trunk@48086 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-18 20:59:43 +00:00
Pascal Birchler b58973554d Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.


git-svn-id: https://develop.svn.wordpress.org/trunk@48072 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-17 15:22:49 +00:00
TimothyBlynJacobs 2b42ac5a12 REST API: Only register one block renderer route.
Every block has a different set of attributes. These attributes are specified as a JSON Schema object. Previously, every block registered its own block renderer route using its attributes for the schema. This allowed for the attributes to be validated using the built in endpoint validation rules. It had the unfortunate side effect, however, of creating a large number of nearly identical REST API routes, one for each dynamic block. Each registered route has a performance impact. As the number of server side blocks goes up, this becomes more and more of an issue.

Now, we register a single block renderer route and dynamically validate the attributes based on the selected block.

Fixes #48079.
Props gziolo, TimothyBlynJacobs.


git-svn-id: https://develop.svn.wordpress.org/trunk@48069 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-17 03:20:02 +00:00
Jake Spurlock d17a57a945 Themes: Add additional later escaping to `post_class()` and `body_class()` functions.
Additionally, this adds a few tests to test output.

Fixes #20009.

Props mfields, scribu, azaozz, obenland, dd32, nacin, jrf, jdgrimes, garyj, whyisjake. 
 


git-svn-id: https://develop.svn.wordpress.org/trunk@48060 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 16:55:45 +00:00
Andrea Fercia 50ece6d31c I18N: Remove the "Error:" prefix from error messages.
For a number of years, most of the WordPress error messages have been prefixed with "Error:". However, these messages appear in a context where it's already clear an error occurred. Whether it's an error, a warning, or any other classification, that's not so relevant for users. The content of the message is the relevant part. The "Error:" prefix doesn't add great value while it does add unnecessary complexity for the message readability.

Also, revises some of these messages to improve clarity and removes HTML from translatable strings.

Props garrett-eclipse, ramiy, SergeyBiryukov, afercia, sabernhardt, quadthemes, audrasjb. 
See #47003, #43037, #42945, #15887.
Fixes #47656.


git-svn-id: https://develop.svn.wordpress.org/trunk@48059 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 15:33:37 +00:00
Jonathan Desrosiers 6334056f65 Build/Test Tools: Prevent double `/`s when including PHPMailer files.
`ABSPATH` includes a trailing slash already.

Follow up of [48033].
Props desrosj.
See #50377, #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48058 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-16 13:57:05 +00:00
Jonathan Desrosiers dfcbff2db0 Emoji: Upgrade Twemoji to version 13.0.0.
🥸

Props kraftbj, desrosj, otto42.
Fixes #50148.

git-svn-id: https://develop.svn.wordpress.org/trunk@48048 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-15 18:02:14 +00:00
Sergey Biryukov d9c53241dc Networks and Sites: Don't unnecessarily switch to the current blog in `get_blog_details()`.
Props arpitgshah, djennez, acsnaterse, joostdevalk, SergeyBiryukov.
Fixes #50391.

git-svn-id: https://develop.svn.wordpress.org/trunk@48044 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-15 12:29:13 +00:00
Sergey Biryukov eb06a59f53 Posts, Post Types: Introduce `default_category_post_types` filter.
The filter allows custom post types associated with the `category` taxonomy to opt in to requiring a default category, same as regular posts.

Props enrico.sorcinelli.
Fixes #43516.

git-svn-id: https://develop.svn.wordpress.org/trunk@48043 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-14 21:40:10 +00:00
Jonathan Desrosiers 0933882c6e External Libraries: Upgrade PHPMailer to version 6.1.6.
Now that WordPress Core supports PHP >= 5.6, the PHPMailer library can be updated to the latest version.

The PHPMailer files now reside in a new directory, `wp-includes/PHPMailer`. These files are copied verbatim from the library upstream and will make updating in the future easier. For backwards compatibility, the old files will remain and trigger deprecated file warnings.

The PHPMailer class is also now under the `PHPMailer\PHPMailer\PHPMailer` namespace. The `PHPMailer` class in the global namespace has been aliased for a seamless transition.

This upgrade also clears up a handful of PHP compatibility issues detailed in #49922.

For a full list of changes, see the PHPMailer GitHub: https://github.com/PHPMailer/PHPMailer/compare/v5.2.27...v6.1.6.

Props Synchro, SergeyBiryukov, desrosj, donmhico, ayeshrajans.
Fixes #41750.

git-svn-id: https://develop.svn.wordpress.org/trunk@48033 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-12 15:45:30 +00:00
Jake Spurlock 2efbc51712 Editor: Ensure latest comments can only be viewed from public posts.
Props: poena, xknown. 


git-svn-id: https://develop.svn.wordpress.org/trunk@47984 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 19:18:50 +00:00
Jake Spurlock fe83aca573 Embeds: Ensure that the title attribute is set correctly on embeds.
Props xknown.


git-svn-id: https://develop.svn.wordpress.org/trunk@47947 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 16:34:18 +00:00
Timothy Jacobs ddf897db05 REST API: Fix updating "multiple" meta keys with non-string values.
Previously, the REST API would end up deleting each row of metadata and recreating it unnecessarily. This was caused by a type mismatch where the metadata API would always return a string value, and the REST API operated on a typed value.

The REST API now applies the same sanitization and type casting for "multiple" meta keys and "single" meta keys.

Fixes #49339.
Props renathoc.


git-svn-id: https://develop.svn.wordpress.org/trunk@47943 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-10 02:20:18 +00:00
Jonathan Desrosiers 45e9cb7066 Coding Standards: Cleans up some PHPCS issues introduced in [47938].
See #20875.

git-svn-id: https://develop.svn.wordpress.org/trunk@47942 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 22:40:50 +00:00
Jake Spurlock d4d78e4ae7 Cache API: Introduce `wp_cache_get_multi()`.
Many caching backend have support for multiple gets in a single request. This brings that support to core, with a compatability fallback that will loop over requests if needed.

Fixes: #20875.
Props: nacin, tollmanz, wonderboymusic, ryan, jeremyfelt, spacedmonkey, boonebgorges, dd32, rmccue, ocean90, jipmoors, johnjamesjacoby, tillkruess, donmhico, davidbaumwald, SergeyBiryukov, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@47938 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 19:45:27 +00:00
Sergey Biryukov 65f22692bb Networks and Sites: Ensure the site ID in `wp_insert_site()` is still correct after calling `clean_blog_cache()`.
By saving `$wpdb->insert_id` to a variable, we make sure the ID does not change if another database insert is performed on the `clean_site_cache` action.

Props trepmal.
Fixes #50324.

git-svn-id: https://develop.svn.wordpress.org/trunk@47932 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-09 12:39:09 +00:00
Timothy Jacobs f5dde31290 REST API: Support the (min|max)Items JSON Schema keywords.
A future commit will add support for the uniqueItems keyword.

Props sorenbronsted.
See #48821.


git-svn-id: https://develop.svn.wordpress.org/trunk@47923 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-07 22:40:16 +00:00
Timothy Jacobs 4fb1e58c50 REST API: Add additional fields to the themes controller.
When the themes controller was introduced it only returned a theme's supported features. This adds the majority of a theme's header information to the response.

Props ockham, spacedmonkey.
Fixes #49906.


git-svn-id: https://develop.svn.wordpress.org/trunk@47921 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-07 06:44:08 +00:00
Sergey Biryukov d4d709856b Docs: Update the DocBlock for the `wp_media_attach_action` hook per the documentation standards.
Rename the `$att_id` variable to `$attachment_id` for clarity.

Follow-up to [47909].

See #49614.

git-svn-id: https://develop.svn.wordpress.org/trunk@47913 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-05 08:28:42 +00:00
Jake Spurlock e756de59e5 REST API: Ensure that all properties of `get_endpoint_args_for_item_schema` are listed.
* Add new var $valid_schema_properties to match rest_validate_value_from_schema()
* Unit test to ensure all valid properties exists, and non-valid properties are ignored

Fixes: #50301.
Props: pentatonicfunk, TimothyBlynJacobs.



git-svn-id: https://develop.svn.wordpress.org/trunk@47911 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-04 16:41:47 +00:00
Aaron Jorbin 42efaab548 Build/Test: Die with an error if populate_network fails
If you are missing WP_TESTS_EMAIL, populate_network will fail and it can be hard to debug. As populate_network can return a wp_error object, we can detect that and display the error to a user.

See: https://github.com/WordPress/gutenberg/pull/22613
Fixes: #50251
Props: TimothyBlynJacobs


git-svn-id: https://develop.svn.wordpress.org/trunk@47904 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-03 21:02:42 +00:00
Adam Silverstein fa96d59318 Formatting: add a new 'safe_style_disallowed_chars' filter.
Enable developers to change the regex used in `safecss_filter_attr` to limit characters in the parsed CSS.

Props paulschreiber, swissspidy, rmccue, bartekcholewa, miinasikk.
Fixes #37134.



git-svn-id: https://develop.svn.wordpress.org/trunk@47891 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-02 23:44:40 +00:00
Dominik Schilling 2fed7bf581 Build/Test Tools: Avoid an empty "title" heading if no title is set in `_wp_die_handler_exit()` and `_wp_die_handler_txt()`.
Fixes #50297.

git-svn-id: https://develop.svn.wordpress.org/trunk@47882 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 20:48:27 +00:00
Dominik Schilling 178eeaf57e Build/Test Tools: Let `WP_UnitTestCase_Base` extend the namespaced version of PHPUnit's test case class.
With the minimum PHP version requirement set to 5.6 we're now able to use namespaces by default. This replaces `PHPUnit_Framework_TestCase` with `PHPUnit\Framework\TestCase` for `WP_UnitTestCase_Base` to solve autocompletion issues with code editors when using more recent PHPUnit versions. `PHPUnit\Framework\TestCase` is available since PHPUnit 5.4 and now the minimum required PHPUnit version.

Fixes #50236.

git-svn-id: https://develop.svn.wordpress.org/trunk@47880 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 19:41:50 +00:00
Jake Spurlock 0ad7471880 Canonical: Add the ability to disable `redirect_guess_404_permalink()`.
This also adds a few more filters to make adding redirects easier. Notably:

1. `do_redirect_guess_404_permalink`
2. `pre_redirect_guess_404_permalink`
3. `strict_redirect_guess_404_permalink`

Fixes: #16557.
Props: msafi, nacin, simonwheatley, westi, mboynes, joostdevalk, Lex_Robinson, MikeSchinkel, haukep, paulschreiber, DrewAPicture, ravenswd, esemlabel, stevegibson12, martychc23, DrLightman, jivanpal, neonkowy, laternastudio, apedog, audrasjb, davidbaumwald, Confridin, donmhico, ryotsun. 



git-svn-id: https://develop.svn.wordpress.org/trunk@47878 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 18:47:41 +00:00
Dominik Schilling 028299ac79 Editor: Fix code style for constructor arguments added in [47875].
Also revert unintended changes to `WP_Block_Type::__construct()` DocBlock.

See #48529.

git-svn-id: https://develop.svn.wordpress.org/trunk@47876 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 16:25:18 +00:00
Greg Ziółkowski 822ca9ebc7 Add fields to WP_Block_Type
As part of #47620 and the RFC for block registeration. Server registered blocks are missing some fields. These changeset includes them.

Props spacedmonkey, aduth.

Fixes #48529.



git-svn-id: https://develop.svn.wordpress.org/trunk@47875 602fd350-edb4-49c9-b593-d223f7449a82
2020-06-01 12:25:34 +00:00
Jake Spurlock 38744d8bd2 Code Standards: Clean up whitespace on the end of a file.
See: #45163.
Props: whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@47866 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-29 23:34:00 +00:00
Jake Spurlock 7b13f5abd8 Taxonomy: Extend `get_term_by` to accept `ID` as a term parameter.
Similar to `get_user_by`, both `ID` and `id` should be able to accepted.

Fixes #45163.
Props emrikol, esoj.
 


git-svn-id: https://develop.svn.wordpress.org/trunk@47865 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-29 22:41:25 +00:00
Dominik Schilling f37a28858d Role/Capability: Use meta caps `edit_post`, `read_post`, and `delete_post` directly.
Rather than consulting the post type object, let `map_meta_cap()` handle that for us.

Props peterwilsoncc, ocean90.
Fixes #50128.
See #23226.

git-svn-id: https://develop.svn.wordpress.org/trunk@47850 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-23 15:22:53 +00:00
Dominik Schilling 584df2a169 Rest API: Ensure `rest_ensure_response()` upgrades `WP_HTTP_Response` to `WP_REST_Response`.
An instance of `WP_HTTP_Response` doesn't ensure that the required methods used in `WP_REST_Server::dispatch()` exist, currently causing a fatal error.

Props ali11007, TimothyBlynJacobs, ocean90.
Fixes #49495.

git-svn-id: https://develop.svn.wordpress.org/trunk@47849 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-23 14:34:38 +00:00
Jake Spurlock 3ab28fd579 REST API: Ensure proper namespacing when registering routes.
The PR will corerce routes that have a leading slash and throwing a `_doing_it_wrong` notice while ensuring a proper namespace.

Fixes #49749.
Props TimothyBlynJacobs, skarabeq, afercia.



git-svn-id: https://develop.svn.wordpress.org/trunk@47842 602fd350-edb4-49c9-b593-d223f7449a82
2020-05-22 20:46:03 +00:00