Joe Hoyle
c15065dddf
REST API: Remove get_allowed_query_vars() now `filter` is gone.
...
Now all public query vars are not supoprted via `?filter` in the REST API, we can remove the get_allowed_query_vars() method and filter. To provide developers with a good altnerative to `filter`, the `"rest_{$this->post_type}_collection_params"` filter has been added.
Props rmccue, rachelbacker, danielbachhuber.
Fixes #38629 .
Built from https://develop.svn.wordpress.org/trunk@39162
git-svn-id: http://core.svn.wordpress.org/trunk@39102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 14:08:32 +00:00
Joe Hoyle
8de95582e2
REST API: Remove rest_get_post filter and `get_post` abstraction.
...
This filter was originally introduced in https://github.com/WP-API/WP-API/pull/2535 to support Customizer Changesets (née Transactions). This is a super broad filter and doesn't really fit with the design of the API, nor is it (arguably) the right level to do this.
Props rmccue.
Fixes #38701 .
Built from https://develop.svn.wordpress.org/trunk@39161
git-svn-id: http://core.svn.wordpress.org/trunk@39101 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 13:09:33 +00:00
Ryan McCue
caabc52753
REST API: Respect unfiltered_html for HTML comment fields.
...
Same as [39155], but for comments, natch.
Props jnylen0.
Fixes #38704 , see #38609 .
Built from https://develop.svn.wordpress.org/trunk@39157
git-svn-id: http://core.svn.wordpress.org/trunk@39097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 06:36:31 +00:00
Ryan McCue
f1975b18ea
REST API: Respect unfiltered_html for HTML post fields.
...
This necessitates a change to our slashing code as well. Ah slashing, the cause of, and solution to, all of life's problems.
Props jnylen0.
Fixes #38609 .
Built from https://develop.svn.wordpress.org/trunk@39155
git-svn-id: http://core.svn.wordpress.org/trunk@39095 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 05:55:32 +00:00
Ryan McCue
8760c9a91d
REST API: Change attachment caption & description to objects.
...
Just like excerpt and content for regular posts, these have transformations applied that can make the content significantly different from the raw value.
Props jnylen0.
Fixes #38679 .
Built from https://develop.svn.wordpress.org/trunk@39154
git-svn-id: http://core.svn.wordpress.org/trunk@39094 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-08 04:29:32 +00:00
Rachel Baker
5564716a07
REST API: Modify the structure of our DELETE responses to be more explicit.
...
Add the `deleted` property to the root of the Response object to communicate if the delete action was successful. Move the state of the resource prior to the delete request under a new `previous` property. As a result DELETE responses are now structured like so:
`{ deleted: true, previous: { ... } }`
Also includes helpful information to DELETE requests for resources that are not trashable.
Props timmydcrawford, rmccue, jnylen0.
Fixes #38494 .
Built from https://develop.svn.wordpress.org/trunk@39126
git-svn-id: http://core.svn.wordpress.org/trunk@39066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-04 17:11:29 +00:00
Ryan McCue
721cf281a3
REST API: Only provide JSON error code on PHP 5.3+.
...
json_last_error() was only added to PHP 5.3.0, so we can't provide the information for older versions.
See #38547 .
Built from https://develop.svn.wordpress.org/trunk@39111
git-svn-id: http://core.svn.wordpress.org/trunk@39053 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 04:57:30 +00:00
Joe Hoyle
6b08485cfa
REST API: Return error when JSON decoding fails.
...
If you send a request to the REST API with invalid JSON in body than it will now return a error. This assists developers if they accidentally send invalid JSON and wonder why their data appears to be ignored.
Props rmccue.
Fixes #38547 .
Built from https://develop.svn.wordpress.org/trunk@39109
git-svn-id: http://core.svn.wordpress.org/trunk@39051 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 04:05:36 +00:00
Rachel Baker
8c9f4f812a
REST API: Return a `WP_Error` when a user does not have permission to create or update a post with the provided terms.
...
Add the 'assign_term' check for post create and update.
Props boonebgorges, johnbillion.
Fixes #38505 .
Built from https://develop.svn.wordpress.org/trunk@39108
git-svn-id: http://core.svn.wordpress.org/trunk@39050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 03:16:30 +00:00
Joe Hoyle
d544c6ddd0
REST API: Switch to stable version of JSON Schema.
...
Props danielbachhuber.
Fixes #38635 .
Built from https://develop.svn.wordpress.org/trunk@39106
git-svn-id: http://core.svn.wordpress.org/trunk@39048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 02:22:29 +00:00
Rachel Baker
dcb12c35cf
REST API: Clean-up our validation callbacks and add missing array `items` properties in our endpoint schemas.
...
Props joehoyle, jnylen0.
Fixes #38617 .
Built from https://develop.svn.wordpress.org/trunk@39105
git-svn-id: http://core.svn.wordpress.org/trunk@39047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 02:18:29 +00:00
Joe Hoyle
901c4ed17a
REST API: Support querying for multiple post statuses.
...
Multiple post statuses can be specified by the usual CSV or array-propper format.
Props jnylen0, kadamwhite, websupporter.
Fixes #38420 .
Built from https://develop.svn.wordpress.org/trunk@39104
git-svn-id: http://core.svn.wordpress.org/trunk@39046 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 01:46:29 +00:00
Rachel Baker
676ae9fc2b
REST API: Use the `items` attribute for the taxonomies `types` schema property for proper sanitization/validation.
...
Props danielbachhuber, joehoyle.
Fixes #38631 .
Built from https://develop.svn.wordpress.org/trunk@39103
git-svn-id: http://core.svn.wordpress.org/trunk@39045 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 01:26:28 +00:00
Rachel Baker
94ab2f9b16
REST API: Return an error when the length of a comment field is too long.
...
Introduces `wp_check_comment_data_max_lengths()` which allows both the REST API comments endpoints and `wp_handle_comment_submission()` to check the length of the comment content, author name, author url, and author email fields against their respective database columns.
Props rachelbaker, mangeshp, salcode, pento.
Fixes #38477 .
Built from https://develop.svn.wordpress.org/trunk@39101
git-svn-id: http://core.svn.wordpress.org/trunk@39043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-03 01:12:31 +00:00
Joe Hoyle
5666292dda
REST API: Include `taxonomies` as an attribute of post types.
...
Add the taxonomies for a post type to the `/wp/v2/types` endpoint, so clients know which taxonomies are available for which post types.
Props danielbachhuber.
Fixes #38438 , #38631 .
Built from https://develop.svn.wordpress.org/trunk@39097
git-svn-id: http://core.svn.wordpress.org/trunk@39039 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 21:51:30 +00:00
Joe Hoyle
37858faf96
REST API: Add en_US to the locales enum.
...
Props ocean90.
Fixes #38528 .
Built from https://develop.svn.wordpress.org/trunk@39096
git-svn-id: http://core.svn.wordpress.org/trunk@39038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 21:21:32 +00:00
Ryan McCue
34cf5d8934
REST API: Allow querying for multiple `slug` values.
...
Props jnylen0, rachelbaker.
Fixes #38579 .
Built from https://develop.svn.wordpress.org/trunk@39093
git-svn-id: http://core.svn.wordpress.org/trunk@39035 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 07:14:29 +00:00
Ryan McCue
624def0ec3
REST API: Add update and delete endpoints to /users/me
...
Now that /users/me is a standalone resource, it should have all the standard endpoints for a resource.
Props pento.
Fixes #38521 (hopefully).
Built from https://develop.svn.wordpress.org/trunk@39092
git-svn-id: http://core.svn.wordpress.org/trunk@39034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 06:53:32 +00:00
Ryan McCue
3fef086ede
REST API: Set default sanitize callback if type is set.
...
Props joehoyle, ChopinBach, jnylen0.
Fixes #38593 .
Built from https://develop.svn.wordpress.org/trunk@39091
git-svn-id: http://core.svn.wordpress.org/trunk@39033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 06:28:29 +00:00
Ryan McCue
862724274e
REST API: Add locale to user resource.
...
Props ocean90, joehoyle.
Fixes #38528 .
Built from https://develop.svn.wordpress.org/trunk@39090
git-svn-id: http://core.svn.wordpress.org/trunk@39032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 06:24:29 +00:00
Ryan McCue
a911bf7e2c
REST API: Avoid default sanitization for polymorphic params.
...
Some parameters (`title`, `content`, etc) are objects in the output, but allow objects or strings to be sent in updates for a more ergonomic interface. This is pretty weird behaviour, so the default sanitisation doesn't handle this. We instead handle this ourselves in the preparation.
Props joehoyle, rachelbaker.
Fixes #38529 .
Built from https://develop.svn.wordpress.org/trunk@39089
git-svn-id: http://core.svn.wordpress.org/trunk@39031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 06:02:29 +00:00
Ryan McCue
d7bdd72510
REST API: Change method of merging parameters.
...
`array_merge()` incorrectly reindexes numeric parameters, causing things like `{"123": true}` to be "dropped".
Props sswells, joehoyle.
Fixes #38306 .
Built from https://develop.svn.wordpress.org/trunk@39087
git-svn-id: http://core.svn.wordpress.org/trunk@39029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 05:53:31 +00:00
Ryan McCue
ba039f7546
REST API: Remove the Location redirect for the /users/me endpoint.
...
This is a re-commit of [38980], which was reverted in [38990].
Props youknowriad, jnylen0, pento.
Fixes #38521 .
Built from https://develop.svn.wordpress.org/trunk@39085
git-svn-id: http://core.svn.wordpress.org/trunk@39027 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 03:44:30 +00:00
Ryan McCue
08ea66490b
REST API: Only expose formats supported by the current theme.
...
While it's valid to save any format to the database, and WordPress is totally fine with that, we should only include the formats specified by the theme in the schema.
Props danielbachhuber.
Fixes #38610 .
Built from https://develop.svn.wordpress.org/trunk@39084
git-svn-id: http://core.svn.wordpress.org/trunk@39026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-02 03:37:32 +00:00
Joe Hoyle
f1591eccca
REST API: Add support for "integer" type for meta and options
...
Previously Settings only supported "number" which meant it was possible to push floats to things like posts_per_page. This means now developers can also specify `type => ineger` in meta nad settings resgration.
Props flixos90.
Fixes #38393 .
Built from https://develop.svn.wordpress.org/trunk@39058
git-svn-id: http://core.svn.wordpress.org/trunk@39000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 16:07:31 +00:00
Gary Pendergast
03e34ab461
REST API: Allow a CSV list of user roles to be passed to `/users`.
...
After [39048], this changes explicitly parses the list of user roles as slugs, and adds tests.
Props jnylen0.
Fixes #38557 .
Built from https://develop.svn.wordpress.org/trunk@39056
git-svn-id: http://core.svn.wordpress.org/trunk@38998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 11:11:29 +00:00
Gary Pendergast
9862543913
REST API: Allow a CSV list of term IDs to be passed to `/posts`.
...
[39048] added CSV support to array types, this change explicitly parses term lists as IDs, and adds tests.
Props timmydcrawford, pento.
Fixes #38553 .
Built from https://develop.svn.wordpress.org/trunk@39055
git-svn-id: http://core.svn.wordpress.org/trunk@38997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 11:06:31 +00:00
Drew Jaynes
5f4497f0af
Docs: Fix multiple trivial typos throughout a variety of core files.
...
Props ottok.
Fixes #38489 .
Built from https://develop.svn.wordpress.org/trunk@39051
git-svn-id: http://core.svn.wordpress.org/trunk@38993 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 06:28:32 +00:00
Drew Jaynes
9635867540
Docs: The `query_vars` filter used in the REST posts controller should be notated as a duplicate rather than a new hook.
...
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39049
git-svn-id: http://core.svn.wordpress.org/trunk@38991 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 05:50:29 +00:00
Ryan McCue
4dab905dba
REST API: Support password on non-post post types.
...
The password field was incorrectly only added to "post" post types, but is supported for all post types in the Dashboard UI.
Props jnylen0.
Fixes #38582 .
Built from https://develop.svn.wordpress.org/trunk@39047
git-svn-id: http://core.svn.wordpress.org/trunk@38989 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 03:53:32 +00:00
Gary Pendergast
6c1e98d1fb
REST API: Add support for arrays in schema validation and sanitization.
...
By allowing more fine-grained validation and sanitisation of endpoint args, we can ensure the correct data is being passed to endpoints.
This can easily be extended to support new data types, such as CSV fields or objects.
Props joehoyle, rachelbaker, pento.
Fixes #38531 .
Built from https://develop.svn.wordpress.org/trunk@39046
git-svn-id: http://core.svn.wordpress.org/trunk@38988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 01:48:41 +00:00
Gary Pendergast
dbc4b87b7f
REST API: Allow Content-Type on CORS requests.
...
This allows `POST` requests with a wider variety of `Content-Type' headers - `Content-Type: application/json`, for example.
Props jnylen0.
Fixes #37994 .
Built from https://develop.svn.wordpress.org/trunk@39044
git-svn-id: http://core.svn.wordpress.org/trunk@38986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-31 00:34:33 +00:00
Drew Jaynes
993b3a5c6e
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Users_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39036
git-svn-id: http://core.svn.wordpress.org/trunk@38978 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:52:30 +00:00
Drew Jaynes
b8f14e00ef
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_User_Meta_Fields` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39034
git-svn-id: http://core.svn.wordpress.org/trunk@38976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:28:30 +00:00
Drew Jaynes
90c17ccbf1
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Terms_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39033
git-svn-id: http://core.svn.wordpress.org/trunk@38975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:21:30 +00:00
Drew Jaynes
b71e62b9eb
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Term_Meta_Fields` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39032
git-svn-id: http://core.svn.wordpress.org/trunk@38974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:09:32 +00:00
Drew Jaynes
7d7d0c8599
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Taxonomies_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39031
git-svn-id: http://core.svn.wordpress.org/trunk@38973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:07:33 +00:00
Drew Jaynes
5dfa0c4cee
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Settings_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39030
git-svn-id: http://core.svn.wordpress.org/trunk@38972 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 18:01:30 +00:00
Drew Jaynes
2452f69485
REST: Fix some errant `else if` conditions and add a few missing periods on inline comments.
...
Props mrahmadawais.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39029
git-svn-id: http://core.svn.wordpress.org/trunk@38971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 17:54:30 +00:00
Drew Jaynes
596ee8bc9d
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Revisions_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39028
git-svn-id: http://core.svn.wordpress.org/trunk@38970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 17:50:29 +00:00
Drew Jaynes
1ef0a5514e
REST: Fix a yoda condition in `WP_REST_Request::get_parameter_order()` and add a missing period for an inline comment in `WP_REST_Request::from_url().
...
Props mrahmadawais.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39027
git-svn-id: http://core.svn.wordpress.org/trunk@38969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 17:42:45 +00:00
Drew Jaynes
e84b257852
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Posts_Controller` class.
...
Props Soean, mrahmadawais, flixos90, DrewAPicture.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39026
git-svn-id: http://core.svn.wordpress.org/trunk@38968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 17:37:35 +00:00
Drew Jaynes
7d488bd2b1
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Post_Types_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39025
git-svn-id: http://core.svn.wordpress.org/trunk@38967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 16:51:30 +00:00
Drew Jaynes
04f0340a96
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Post_Statuses_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39024
git-svn-id: http://core.svn.wordpress.org/trunk@38966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 16:44:38 +00:00
Drew Jaynes
c4df9d63ba
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Post_Meta_Fields` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39023
git-svn-id: http://core.svn.wordpress.org/trunk@38965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 16:36:32 +00:00
Drew Jaynes
9ce98d98ac
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Meta_Fields` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39022
git-svn-id: http://core.svn.wordpress.org/trunk@38964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 16:33:30 +00:00
Drew Jaynes
718f9fe868
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39021
git-svn-id: http://core.svn.wordpress.org/trunk@38963 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 16:20:29 +00:00
Drew Jaynes
e2e47a192d
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Comments_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39015
git-svn-id: http://core.svn.wordpress.org/trunk@38957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 06:55:30 +00:00
Drew Jaynes
7d25657c01
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Comment_Meta_Fields` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39014
git-svn-id: http://core.svn.wordpress.org/trunk@38956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 06:34:31 +00:00
Drew Jaynes
08b0407367
Docs: Add much more complete and syntactically correct documentation throughout the `WP_REST_Attachments_Controller` class.
...
Props Soean, mrahmadawais, flixos90.
See #38398 .
Built from https://develop.svn.wordpress.org/trunk@39011
git-svn-id: http://core.svn.wordpress.org/trunk@38953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-30 05:40:37 +00:00