-
Introduce support for Post Meta, Term Meta, User Meta, and Comment Meta in their parent endpoints.
For your meta fields to be exposed in the REST API, you need to register them. WordPress includes a
register_meta()function which is not usually required to get/set fields, but is required for API support.To register your field, simply call register_meta and set the show_in_rest flag to true. Note: register_meta must be called separately for each meta key.
(props @rmccue, @danielbachhuber, @kjbenk, @duncanjbrown, #2765)
-
Introduce Settings endpoint.
Expose options to the REST API with the
register_setting()function, by passing$args = array( 'show_in_rest' => true ). Note: WordPress 4.7 is required. See changeset [38635][https://core.trac.wordpress.org/changeset/38635].(props @joehoyle, @fjarrett, @danielbachhuber, @jonathanbardo, @greatislander, #2739)
-
Attachments controller, change permissions check to match core.
Check for the
upload_filescapability when creating an attachment.(props @nullvariable, @adamsilverstein, #2743)
-
Add
?{taxonomy}_exclude=query parameterThis mirrors our existing support for ?{taxonomy}= filtering in the posts controller (which allows querying for only records with are associated with any of the provided term IDs for the specified taxonomy) by adding an equivalent
_excludevariant to list IDs of terms for which associated posts should NOT be returned.(props @kadamwhite, #2756)
-
Use
get_comment_type()when comparing updating comment status.Comments having a empty
comment_typewithin WordPress bites us again. Fixes a bug where comments could not be updated because of bad comparison logic.(props @joehoyle, #2753)
-
Add support for password protected posts
Password protected posts are now fully supported, you can create edit and read password protected posts in the REST API. There is now a
protectedattribute in thecontentandexcerptfields in post response.To view password protected posts via the API, use the
passwordquery parameter to provide the post's password.(props @joehoyle, #2720)
-
Allow returning an error from field update callbacks
Fields added via
register_rest_fieldcan now return an instance ofWP_Errorin theupdate_callback.(props @rmccue, #2702)
-
Update the wp-api.js client from the client-js repo.
(props @joehoyle, #2746)
-
Add
relevanceorderbyto posts endpoint(props @websupporter, #2579)
-
Ability to order by
slug,emailandurlon the users endpoints.(props @joehoyle, #2721)
-
Add
stickyparameter to the posts endpoint.(props @joehoyle, #2708)
-
Add link to comment children, allowing threaded comment querying
-
Avoid unnecessary SQL query by passing
$user_nicename(props @danielbachhuber, #2435)
-
Don't allow reading / creating of posts with no parent
(props @rachelbaker, #2744)
-
Mark Users'
capabilitiesproperty as readonly(props @danielbachhuber, #2440)
-
Mark some post properties as readonly
-
Use WPINC instead of wp-includes/
(props @websupporter, #2461)
-
Return error, if user can't list users & content=edit
(props @websupporter, #2463)
-
Conditionally model the term response based on its schema
(props @danielbachhuber, #2470)
-
Include Post data on the response object when declared
-
Add boolean type support to rest_validate_request_arg()
(props @westonruter, #2478)
-
Fix create/update requests not processing data included in the schema
(props @websupporter, #2479)
-
Remove Unused Parameter in lib/endpoints/class-wp-rest-controller.php
(props @hideokamoto, #2500)
-
Update post schema status description to reflect csv support.
(props @coderkevin, #2534)
-
Allow Comments to be created with a passed
author_ip(props @rachelbaker, #1880)
-
The get_the_excerpt filter expects the post object as of WP 4.5.
(props @lgedeon, #2553)
-
Introduce WP_REST_Controller::get_post() for allowing plugins to mutate get_post()'s return value
(props @westonruter, #2535)
-
Use
show_in_restto determine "public" post types to check(props @danielbachhuber, #2384)
-
#2426 Fix inconsistent type for user caps
-
Define user
typeas a string, not an array(props @danielbachhuber, #2556)
-
Fix failing test: Typecast the user_id in search to a string
(props @rachelbaker, #2617)
-
#2587 Fix registered date schema
-
Fix forum url and installer-name in readme
(props @torounit, #2656)
-
Document options of the "status" parameter for Post collection GETs
(props @kadamwhite, #2645)
-
Improve WP_REST_Controller::filter_response_by_context().
(props @tfrommen, #2641)
-
#2424 Consistent slashes in rest_url() usage
-
Add filters to allow for relevance search
(props @websupporter, #2665)
-
Alter default comment sort order to be "desc"
(props @kadamwhite, #2684)
-
Add raw and rendered to revisions schema
(props @websupporter, #2693)
-
"WP API" -> "WordPress REST API" in README files
(props @kadamwhite, #2697)
-
Improve boolean validation from schema
-
Fix typo (PUT vs POST) in readme.md
(props @kadamwhite, #2716)
-
Add Codecov configuration
(props @danielbachhuber, #2718)
-
Fix inefficiency in users endpoint using
search => **(props @joehoyle, #2722)
-
Ensure the terms list is a list
(props @joehoyle, #2724)
-
Added @return on handle_featured_media() doc
(props @vishalkakadiya, #2725)
-
#2730 Update attachments fields added with
register_rest_field -
#2582 Ensure the
rolesproperty is always an array -
Move post_password_required filtering to preparation
(props @rmccue, #2735)
-
Use wrapper for
sanitize_titleto avoid messed up slugs.(props @joehoyle, #2723)
-
Force per_page to override the filter variable
(props @rmccue, #2699)
-
BREAKING CHANGE: Fix Content-Disposition header parsing.
Allows regular form submissions from HTML forms, as well as properly formatted HTTP requests from clients. Note: this breaks backwards compatibility, as previously, the header parsing was completely wrong.
(props @rmccue, #2239)
-
BREAKING CHANGE: Use compact links for embedded responses if they are available.
Introduces curies for sites running WordPress 4.5 or greater; no changes for those running WordPress 4.4.
(props @joehoyle, #2412)
-
JavaScript client updates:
- Support lodash, plus older and newer underscore: add an alias for
_.contains - Add args and options on the model/collection prototypes
- Rework category/tag mixins to support new API structure
- Add workaround for the null/empty values returned by the API when creating a new post - these values are not accepted for subsequent updates/saves, so explicitly excluding them. See WP-API#2393
- Better handling of the (special)
meendpoint - Schema parsing cleanup
- Introduce
wp.api.loadPromiseso developers can ensure api load complete before using
(props @adamsilverstein, #2403)
- Support lodash, plus older and newer underscore: add an alias for
-
Only adds alternate link header for publicly viewable CPTs.
(props @bradyvercher, #2387)
-
Adds
rolesparam forGET /wp/v2/users.(props @BE-Webdesign, #2372)
-
Declares
passwordin user schema, but never displays it.(props @danielbachhuber, #2386)
-
Permits
editcontext for requests which can edit the user.(props @danielbachhuber, #2383)
-
Adds
rest_pre_insert_{$taxonomy}filter for terms.(props @kjbenk, #2377)
-
Supports taxonomy collection args on posts endpoint.
(props @joehoyle, #2287)
-
Removes post meta link from post response.
(props @joehoyle, #2288)
-
Registers
descriptionattribute when registering args from schema.(props @danielbachhuber, #2362)
-
Uses
$commentfrom the database withrest_insert_commentaction.(props @danielbachhuber, #2349)
-
Removes unnecessary global variables from users controller.
(props @claudiosmweb, #2335)
-
Ensures
GET /wp/v2/categorieswith out of bounds offset doesn't return results.(props @danielbachhuber, #2313)
-
Adds top-level support for date queries on posts and comments.
-
Respects
show_avatarssetting for comments.(props @BE-Webdesign, #2271)
-
Uses cached
get_the_terms()for terms-for-post for better performance.(props @rmccue, #2257)
-
Ensures comments search is an empty string.
(props @rmccue, #2256)
-
If no title is provided in create attachment request or file metadata, falls back to filename.
(props @danielbachhuber, #2254)
-
Removes unused
$img_url_basenamevariable in attachments controller.(props @danielbachhuber, #2250)
-
BREAKING CHANGE: Removes meta endpoints from primary plugin.
If your project depends on post meta endpoints, please install WP REST API Meta Endpoints. For the gory history of meta, read #1425 and linked issues. At this time, we recommend using
register_rest_field()to expose meta (docs).(props @danielbachhuber, #2172)
-
BREAKING CHANGE: Returns original resource when deleting PTCU.
Now that all resources require the
forceparam, we don't need to wrap delete responses with thetrashstate.(props @danielbachhuber, #2163)
-
BREAKING CHANGE: Uses
rolesrather thanrolein the Users controller.Building the REST API gives us the opportunity to standardize on
roles, instead of having bothrolesandrole.(props @joehoyle, #2177)
-
BREAKING CHANGES: Moves to consistent use of
contextthroughout controllers.Contexts limit the data present in the response. Here's how to think of them:
embedcorrelates with sidebar representation,viewrepresents the primary public view, andeditis the data expected for an editor.(props @danielbachhuber, #2205, #2204, #2203, #2218, #2216, #2230, #2184, #2235)
-
BREAKING CHANGE: Removes
post_*query param support forGET /wp/v2/comments.The proper pattern is to use
GET /wp/v2/poststo fetch the post IDs to limit the request to.(props @danielbachhuber, #2165)
-
BREAKING CHANGE: Introduces
rest_validate_request_arg()/rest_sanitize_request_arg().Dedicated functions means we can use them for validating / sanitizing query args too. Removes
WP_REST_Controller::validate_schema_property()andWP_REST_Controller::sanitize_schema_property(). -
Requires minimum value of 1 for
pageparam.(props @danielbachhuber, #2241)
-
Introduces
media_typeandmime_typeparams forGET /wp/v2/media.(props @danielbachhuber, #2231)
-
Uses the term cache for post data.
(props @rmccue, #2234)
-
Supports for querying comments where
post=0.(props @danielbachhuber, #1865)
-
Exposes taxonomy and post type capabilities in
context=edit.(props @danielbachhuber, #2216)
-
Errors early when user can't GET types or taxonomies when
context=edit.(props @danielbachhuber, #2218)
-
Passes original $request context to
prepare_items_query.(props @danielbachhuber, #2211)
-
Adds
parentandparent_excludeparams to GET Comments.(props @danielbachhuber, #2206)
-
Enforces minimum 1 and maximum 100 values for
per_pageparameter.(props @danielbachhuber, #2209)
-
Adds
authorandauthor_excludeparams to GET Posts and Comments. -
Adds
menu_orderparam forGETPages; supportmenu_orderorderby.(props @danielbachhuber, #2193)
-
Only calls
sanitize_text_field()when sanitizingtype=string,format=email.(props @danielbachhuber, #2185)
-
Validates
GET /wp/v2/commentsprivate query params.Returns an error when user doesn't have permission to use them, instead of silently discarding.
(props @danielbachhuber, #2178)
-
Explicitly prevents uploading attachments to other attachments or revisions.
(props @danielbachhuber, #2180)
-
Permits user urls to be edited through the API.
(props @danielbachhuber, #2182)
-
Marks all Status, Type and Taxonomy fields as
readonly.(props @danielbachhuber, #2181)
-
Adds validation callbacks to collection query params.
-
Links taxonomy terms to the post type collections they support.
(props @danielbachhuber, #2167)
-
Returns error when making a
GETrequest with invalid context.(props @danielbachhuber, #2169)
-
Adds
trashstatus toGET /wp/v2/statuses.(props @danielbachhuber, #2158)
-
Indicates when fields have HTML in schema.
(props @joehoyle, #2159)
-
Permits viewing of User who has published any Public posts.
(props @danielbachhuber, #2155)
-
Respects
show_avatarsoption when adding avatars to Users.(props @nullvariable, #2151)
-
Controllers use
$namespaceand$rest_baseclass variables for easier subclassing.(props @danielbachhuber, #2119, #2130, #2131, #2132, #2133, #2134, #2139, #2141, #2142)
-
BREAKING CHANGE: Moves Post->Term relations to the Post Resource
Previously, a client would fetch a Post's Tags with
GET /wp/v2/posts/<id>/tags.In Beta 11, an array of term ids is included on the Post resource.
The collection of terms for a Post can be fetched with
GET /wp/v2/tags?post=<id>.The
WP_REST_Posts_Terms_Controllerclass no longer exists.(props @joehoyle, #2063)
-
BREAKING CHANGE: Adds latest JS client including a minified version.
See pull request for a summarized changelog.
(props @adamsilverstein, #1981)
-
BREAKING CHANGE: Changes
featured_imageattribute on Posts tofeatured_media.While featuring other attachment types isn't yet officially supported, this makes it easier for us to introduce the possibility in the future.
(props @danielbachhuber, #2044)
-
BREAKING CHANGE: Uses discrete schema title for categories and tags.
If you've used
register_rest_field( 'term' ), you'll need to change'term'to'tag'and/or'category'.(props @danielbachhuber, #2005)
-
BREAKING CHANGE: Makes many filters dynamic based on the controller type.
If you were using the
rest_prepare_termfilter, you'll need to change it torest_prepare_post_tagorrest_prepare_category.If you were using
rest_post_queryorrest_terms_query, you'll need update your use torest_page_query, etc.If you were using
rest_post_trashable,rest_insert_postorrest_delete_post, they are now dynamic based on the post type slug. -
Renames
GET /wp/v2/commentsuserparam toauthorto match resource attribute.Not a breaking change, because it didn't work in the first place.
(props @danielbachhuber, #2105)
-
Adds support for
GET /wp/v2/pages parent=1,2,3.(props @danielbachhuber, #2101)
-
Persists image metadata title and caption when not present in the request.
(props @danielbachhuber, #2079)
-
Add
parent_excludeparam toGET /wp/v2/posts.(props @danielbachhuber, #2077)
-
Adds
slugparam support for collections of Posts, Users, and Taxonomy Terms. -
When a comment is already trashed, returns
410:rest_already_trashed.(props @danielbachhuber, #2069)
-
Filter the responses by context after processing additional fields.
(props @danielbachhuber, #2067)
-
Adds
offsetparam support for collections of Posts, Users, Comments, and Taxonomy Terms. -
Adds
rest_insert_{$taxonomy}andrest_delete_{$taxonomy}actions.(props @danielbachhuber, #2060)
-
Provides more helpful error message/code on Post Create/Update fail.
(props @danielbachhuber, #2053)
-
Forces
GET /wp/v2/mediato be limited to'status' => [ inherit, private, trash ](props @danielbachhuber, #2026)
-
Uses more correct error code for
Comment::deletepermission check.(props @danielbachhuber, #2054)
-
Calls
prepare_item_for_response()directly in create and update methods.This lets us pass the original request through, giving the method and its filter genuine context, and avoids an unnecessary call to
get_item(). -
Moves permission check methods across controllers.
Placing them above the method they're supposed to check makes the code more readable.
(props @danielbachhuber, #2030, #2029, #2034, #2036, #2037, #2035, #2039)
-
Requires
forceargument forDELETE /wp/v2/<taxonomy>/<id>.(props @danielbachhuber, #2028)
-
Conditionally requires and defines REST API classes and functions.
-
Avoid a duplicate query for the comment count.
(props @rmccue, #2015)
-
Parses
$dateif available inprepare_date_response()(props @adamsilverstein, #1951)
-
Abstracts
POST /wp/v2/mediapermissions check.(props @danielbachhuber, #2003)
-
Adds
excludeparam to getting collections of Posts, Users, Comments, and Taxonomy Terms. -
Adds
rest_comment_queryfor filteringGET /wp/v2/comments.(props @danielbachhuber, #2007)
-
Uses HTTP status code
500fordb_update_errorwhen creating an attachment.(props @danielbachhuber, #1993)
-
Adds helpful description to
forceparam across allDELETEregistrations -
In
GET /wp/v2/<taxonomy>, drops support fororderby=>term_id.Only one
idis exposed through the REST API.(props @danielbachhuber, #1990)
-
SECURITY: Ensure media of private posts are private too.
Reported by @danielbachhuber on 2016-01-08.
-
BREAKING CHANGE: Removes compatibility repo for WordPress 4.3.
WordPress 4.4 is now the minimum supported WordPress version.
(props @danielbachhuber, #1848)
-
BREAKING CHANGE: Changes link relation for types and taxonomies.
In Beta 9, this link relation was introduced as
item, which isn't correct. The relation has been changed tohttps://api.w.org/items.(props @danielbachhuber, #1853)
-
BREAKING CHANGE: Introduces
editcontext forwp/v2/typesandwp/v2/taxonomies.Some fields have moved into this context, which require
edit_postsandmanage_terms, respectively. -
BREAKING CHANGE: Removes
post_formatas a term_linkfor Posts.Post formats aren't a custom taxonomy in the eyes of the REST API.
(props @danielbachhuber, #1854)
-
Declares
parentquery param for Pages.(props @danielbachhuber, #1975)
-
Permits logged-in users to query for media.
(props @danielbachhuber, #1973)
-
Removes duplicated query params from Terms controller.
(props @danielbachhuber, #1963)
-
Adds
includeparam to/wp/v2/posts,/wp/v2/users,/wp/v2/<taxonomy>and/wp/v2/comments. -
Ensures
GET /wp/v2/postsrespectsorderandorderbyparams.(props @danielbachhuber, #1962)
-
Fixes fatal by loading
wp-admin/includes/user.phpto exposewp_delete_user().(props @danielbachhuber, #1958)
-
Permits making a post sticky when also supplying an empty password.
(props @westonruter, #1949)
-
Uses
WP_REST_Requestinternally across controllers. -
Cleans up permissions checks in
WP_REST_Terms_Controller.(props @danielbachhuber, #1941)
-
Uses
show_in_restto determine publicness for post types.(props @danielbachhuber, #1942)
-
Makes
descriptionstrings available for translation.(props @danielbachhuber, #1944)
-
Checks
assign_termscap for taxonomy when managing post terms.(props @danielbachhuber, #1940)
-
Defer to
edit_postsof the custom post type when accessing private query vars.(props @danielbachhuber, #1886)
-
Allows Terms collection params to be filtered.
(props @rachelbaker, #1882)
-
Renames post terms create/delete permissions callback.
(props @wpsmith, #1923)
-
Fixes invalid use of 'uri' as schema
type.(props @wpsmith, #1913)
-
Casts integer with (int) over intval for speed.
(props @wpsmith, #1907)
-
Fixes PHP Doc typo for
validate_schema_propertyandsanitize_schema_property. -
Adds a helpful description to the
filterargument.(props @danielbachhuber, #1885)
-
Changes order of Users response to match schema order.
(props @rachelbaker, #1879)
-
Adjusts Posts pagination headers for
filterparams.(props @rachelbaker, #1878)
-
Uses proper status code when failing to get comments of private post.
(props @danielbachhuber, #1866)
-
Fixes invalid capability for comments get items permissions callback.
manage_commentsdoesn't exist;moderate_commentsdoes.(props @danielbachhuber, #1866)
-
Permits creating comments without an assigned post.
(props @danielbachhuber, #1857)
-
Prevents error notice when
show_in_restisn't set for a post type.(props @danielbachhuber, #1852)
-
BREAKING CHANGE: Move tags and categories to top-level endpoints.
Tags are now accessible at
/wp/v2/tags, and categories accessible at/wp/v2/categories. Post terms reside at/wp/v2/posts/<id>/tagsand/wp/v2/<id>/categories.(props @danielbachhuber, #1802)
-
BREAKING CHANGE: Return object for requests to
/wp/v2/taxonomies.This is consistent with
/wp/v2/typesand/wp/v2/statuses.(props @danielbachhuber, #1825)
-
BREAKING CHANGE: Remove
rest_get_timezone().json_get_timezone()was only ever used in v1. This function causes fatals, and shouldn't be used.(props @danielbachhuber, #1823)
-
BREAKING CHANGE: Rename
register_api_field()toregister_rest_field().Introduces a
register_api_field()function for backwards compat, which calls_doing_it_wrong(). However,register_api_field()won't ever be committed to WordPress core, so you should update your function calls.(props @danielbachhuber, #1824)
-
BREAKING CHANGE: Change taxonomies'
post_typeargument totype.It's consistent with how we're exposing post types in the API.
(props @danielbachhuber, #1824)
-
Sync infrastructure with shipped in WordPress 4.4.
-
Change terms endpoints to use
term_idnottt_id.(props @joehoyle, #1837)
-
Standardize declaration of
contextparam forGETrequests across controllers.However, we're still inconsistent in which controllers expose which params. Follow #1845 for further discussion.
-
Link types / taxonomies to their collections, and vice versa.
Collections link to their type / taxonomy with the
aboutrelation; types / taxonomies link to their colletion with theitemrelation, which is imperfect and may change in the future. -
Add missing 'wp/v2' in Location Response header when creating new Post Meta.
(props @johanmynhardt, #1790)
-
Expose Post collection query params, including
author,order,orderbyandstatus.(props @danielbachhuber, #1793)
-
Ignore sticky posts by default.
(props @danielbachhuber, #1801)
-
Include
fullimage size in attachmentsizesattribute.(props @danielbachhuber, #1806)
-
In text strings, use
idinstead ofID.IDis an implementation artifact. Our Resources useid.(props @danielbachhuber, #1803)
-
Ensure
attachment.sizes[]usemime_typeinstead ofmime-type.(props @danielbachhuber, #1809)
-
Introduce
rest_authorization_required_code().Many controllers returned incorrect HTTP codes, which this also fixes.
(props @danielbachhuber, #1808)
-
Respect core's
comment_registrationsetting.If it's enabled, require users to be logged in to comment.
(props @danielbachhuber, #1826)
-
Default to wildcard when searching users.
(props @danielbachhuber, #1827)
-
Bring the wp-api.js library up to date for v2 of the REST API.
(props @adamsilverstein, #1828)
-
Add
rest_prepare_statusfilter.(props @danielbachhuber, #1830)
-
Make
prepare_*filters more consistent.(props @danielbachhuber, #1831)
-
Add
rest_prepare_post_typefilter for post types.(props @danielbachhuber, #1833)
-
Prevent fatals when uploading attachment by including admin utilities.
(props @danielbachhuber, #1756)
-
Return 201 status code when creating a term.
(props @danielbachhuber, #1753)
-
Don't permit requesting terms cross routes.
Clients should only be able to request categories from the category route, and tags from the tag route.
(props @danielbachhuber, #1764)
-
Set
fields=>idwhen usingWP_User_Queryto fix large memory usage(props @joehoyle, #1770)
-
Fix Post
_linkto attached attachments.(props @danielbachhuber, #1777)
-
Add support for getting a post with a custom public status.
(props @danielbachhuber, #1765)
-
Ensure post content doesn't get double-slashed on update.
(props @joehoyle, #1772)
-
Change 'int' to 'integer' for
WP_REST_Controller::validate_schema_property()(props @wpsmith, #1759)
-
Sync infrastructure from WordPress core as of r35691.
- Remove
register_api_field()because it's conceptually tied toWP_REST_Controller#34730 - Update the REST API header links to use api.w.org #34303
- Require the
$namespaceargument inregister_rest_route()#34416 - Include
enumanddescriptionin help data #34543 - Save
preg_matchiterations inWP_REST_Server#34488 - Don't return route URL in
WP_REST_Request:get_params()#34647
- Remove
-
Restore
register_api_field()within the plugin.(props @danielbachhuber, #1748)
-
Require admin functions for use of
wp_handle_upload(), fixing fatal.(props @joehoyle, #1746)
-
Properly handle requesting terms where
parent=0and0is a string.(props @danielbachhuber, #1739)
-
Prevent PHP error notice when
&filterisn't an array.(props @danielbachhuber, #1734)
-
Change link relations to use api.w.org.
(props @danielbachhuber, #1726)
-
Remove global inclusion of wp-admin/includes/admin.php
For a long time, the REST API loaded wp-admin/includes/admin.php to make use of specific admin utilities. Now, it only loads those admin utilities when it needs them.
If your custom endpoints make use of admin utilities, you'll need to make sure to load wp-admin/includes/admin.php before you use them.
(props @joehoyle, #1696)
-
Link directly to the featured image in a Post's links.
-
Provide object type as callback argument for custom API fields.
(props @jtsternberg, #1714)
-
Change users schema order to be order of importance instead of alpha.
(props @rachelbaker, #1708)
-
Clarify documentation for
dateandmodifiedattributes.(props @danielbachhuber, #1715)
-
Update the wp-api.js client from the client-js repo.
(props @rachelbaker, #1709)
-
Fix the
formatenum to be an array of strings.(props @joehoyle, #1707)
-
Run revisions for collection through
prepare_response_for_collection().(props @danielbachhuber, @rachelbaker, #1671)
-
Expose
date_gmtforviewcontext of Posts and Comments.(props @danielbachhuber, #1690)
-
Fix PHP and JS docblock formatting.
(props @ahmadawais, #1699, #1699, #1701, #1700, #1702, #1703)
-
Include
media_detailsattribute for attachments in embed context.For image attachments, media_details includes a sizes array of image sizes, which is useful for templating.
(props @danielbachhuber, #1667)
-
Make
WP_REST_Controllererror messages more helpful by specifying method to subclass.(props @danielbachhuber, #1670)
-
Expose
sluginembedcontext for Users.user_nicenameis a public attribute, used in user URLs, so this is safe data to present.(props @danielbachhuber, #1666)
-
Handle falsy value from
wp_count_terms(), fixing fatal.(props @joehoyle, #1641)
-
Correct methods in
WP_REST_SERVER::EDITABLEdescription.(props @rachelbaker, #1601)
-
Add the embed context to Users collection query params.
(props @rachelbaker, #1591)
-
Add Terms Controller collection args details.
(props @rachelbaker, #1603)
-
Set comment author details from current user.
(props @rmccue, #1580)
-
More hook documentation.
-
Return the trashed status of deleted posts/comments.
When a post or a comment is deleted, returns a flag to say whether it's been trashed or properly deleted.
(props @pento, #1499)
-
In
WP_REST_Posts_Controller::update_item(), check the post ID based on the proper post type.(props @rachelbaker, #1497)
-
Load api-core as a compatibility library
Now api-core has been merged into WordPress trunk (for 4.4) we should no longer load the infrastructure code when it's already available. This also fixes a fatal error for users who were on trunk.
(props @rmccue)
-
Switch to new mysql_to_rfc3339
(props @rmccue)
-
Double-check term taxonomy
(props @rmccue)
-
Load admin functions
This was removed from the latest beta of WordPress in the REST API infrastructure, a more long term fix is planned.
(props @joehoyle)
-
Add Add compat shim for renamed
rest_mysql_to_rfc3339()(props @danielbachhuber)
-
Compat shim for
wp_is_numeric_array()(props @danielbachhuber)
-
Revert Switch to register_post_type_args filter
(props @joehoyle)
-
Show public user information through the user controller.
In WordPress as of r32683 (scheduled for 4.3),
WP_User_Querynow has support for getting users with published posts.To match current behaviour in WordPress themes and feeds, we now expose this public user information. This includes the avatar, description, user ID, custom URL, display name, and URL, for users who have published at least one post on the site. This information is available to all clients; other fields and data for all users are still only available when authenticated.
-
Send schema in OPTIONS requests and index.
Rather than using separate
/schemaendpoints, the schema for items is now available through an OPTIONS request to the route. This means that full documentation is now available for endpoints through an OPTIONS request; this includes available methods, what data you can pass to the endpoint, and the data you'll get back.This data is now also available in the main index and namespace indexes. Simply request the index with
context=helpto get full schema data. Warning: this response will be huge. The schema for single endpoints is also available in the collection's OPTIONS response.⚠️ This breaks backwards compatibility for clients relying on schemas being at their own routes. These clients should instead sendOPTIONSrequests.Custom endpoints can register their own schema via the
schemaoption on the route. This option should live side-by-side with the endpoints (similar torelationin WP's meta queries), so your registration call will look something like:register_rest_route( 'test-ns', '/test', array( array( 'methods' => 'GET', 'callback' => 'my_test_callback', ), 'schema' => 'my_schema_callback', ) );
-
Update JavaScript API for version 2.
Our fantastic JavaScript API from version 1 is now available for version 2, refreshed with the latest and greatest changes.
As a refresher: if you want to use it, simply make your script depend on
wp-apiwhen you enqueue it. If you want to enqueue the script manually, addwp_enqueue_script( 'wp-api' )to a callback onwp_enqueue_scripts. -
Embed links inside items in a collection.
Previously when fetching a collection of items, you only received the items themselves. To fetch the links as well via embedding, you needed to make a request to the single item with
_embedset.No longer! You can now request a collection with embeds enabled (try
/wp/v2/posts?_embed). This will embed links inside each item, allowing you to build interface items much easier (for example, post archive pages can get featured image data at the same time).This also applies to custom endpoints. Any endpoint that returns a list of objects will automatically have the embedding applied to objects inside the list.
-
Fix potential XSS vulnerability.
Requests from other origins could potentially run code on the API domain, allowing cross-origin access to authentication cookies or similar.
Reported by @xknown on 2015-07-23.
-
Move
/postsWP_Queryvars back tofilterparam.In version 1, we had internal
WP_Queryvars available viafilter(e.g.filter[s]=search+term). For our first betas of version 2, we tried something different and exposed these directly on the endpoint. The experiment has now concluded; we didn't like this that much, sofilteris back.We plan on adding nicer looking arguments to collections in future releases, with a view towards being consistent across different collections. We also plan on opening up the underlying query vars via
filterfor users, comments, and terms as well.⚠️ This breaks backwards compatibility for users using WP Query vars. Simply change yourx=yparameter tofilter[x]=y.(props @WP-API, #1420)
-
Respect
rest_basefor taxonomies.⚠️ This breaks backwards compatibility by changing the/wp/v2/posts/{id}/terms/post_tagendpoint to/wp/v2/posts/{id}/tag.(props @joehoyle, #1466)
-
Add permission check for retrieving the posts collection in edit context.
By extension of the fact that getting any individual post yields a forbidden context error when the
context=editand the user is not authorized, the user should also not be permitted to list any post items when unauthorized.(props @danielpunkass, #1412)
-
Ensure the REST API URL always has a trailing slash.
Previously, when pretty permalinks were enabled, the API URL during autodiscovery looked like
/wp-json, whereas the non-pretty permalink URL looked like?rest_route=/. These are now consistent, and always end with a slash character to simplify client URL building. -
Use
wp_json_encodeinstead ofjson_encodeSince WordPress 4.1,
wp_json_encodehas been available to ensure encoded values are sane, and that non-UTF8 encodings are supported. We now use this function rather than doing the encode ourselves.(props @rmccue, @pento, #1417)
-
Add
roleto schema for users.The available roles you can assign to a user are now available in the schema as an
enum.(props @joehoyle, #1400)
-
Use the schema for validation inside the comments controller.
Previously, the schema was merely a decorative element for documentation inside the comments controller. To bring it inline with our other controllers, the schema is now used internally for validation.
(props @joehoyle, #1422)
-
Don't set the Location header in update responses.
Previously, the Location header was sent when updating resources due to some inadvertent copypasta. This header should only be sent when creating to direct clients to the new resource, and isn't required when you're already on the correct resource.
(props @rachelbaker, #1441)
-
Re-enable the
rest_insert_postaction hook forWP_REST_Posts_ControllerThis was disabled during 2.0 development to avoid breaking lots of plugins on the
json_insert_postaction. Now that we've changed namespaces and are Mostly Stable (tm), we can re-enable the action. -
Fix post taxonomy terms link URLs.
When moving the routes in a previous beta, we forgot to correct the links on post objects to the new correct route. Sorry!
-
Use
wp_get_attachment_image_src()on the image sizes in attachments.Since the first versions of the API, we've been building attachment URLs via
str_replace. Who knows why we were doing this, but it caused problems with custom attachment URLs (such as CDN-hosted images). This now correctly uses the internal functions and filters.(props @joehoyle, #1462)
-
Make the embed context a default, not forced.
If you want embeds to bring in full data rather than with
context=edit, you can now change the link to specifycontext=viewexplicitly.(props @rmccue, #1464)
-
Ensure we always use the
term_taxonomy_idand never exposeterm_idpublicly.Previously,
term_idwas inadvertently exposed in some error responses.(props @jdolan, #1430)
-
Fix adding alt text to attachments on creation.
Previously, this could only be set when updating an attachment, not when creating one.
(props @joehoyle, #1398)
-
Throw an error when registering routes without a namespace.
Namespaces should always be provided when registering routes. We now throw a
doing_it_wrongerror when attempting to register one. (Previously, this caused a warning, or an invalid internal route.)If you really need to register namespaceless routes (e.g. to replicate an existing API), call
WP_REST_Server::register_routedirectly rather than using the convenience function.(props @joehoyle, @rmccue, #1355)
-
Show links on embeds.
Previously, links were accidentally stripped from embedded response data.
(props @rmccue, #1472)
-
Clarify insufficient permisssion error when editing posts.
(props @danielpunkass, #1411)
-
Improve @return inline docs for rest_ensure_response()
(props @Shelob9, #1328)
-
Check taxonomies exist before trying to set properties.
(props @joehoyle, @rachelbaker, #1354)
-
Update controllers to ensure we use
sanitize_callbackwherever possible.(props @joehoyle, #1399)
-
Add more phpDoc documentation, and correct existing documentation.
-
Update testing infrastructure.
Travis now runs our coding standards tests in parallel, and now uses the new, faster container-based testing infrastructure.
-
Add ability to declare sanitization and default options for schema fields.
The
arg_optionsarray can be used to declare the sanitization callback, default value, or requirement of a field.(props @joehoyle, [#1345][gh-1345]) (props @joehoyle, [#1346][gh-1346])
-
Expand supported parameters for creating and updating Comments.
(props @rachelbaker, [#1245][gh-1245])
-
Declare collection parameters for Terms of a Post.
Define the available collection parameters in
get_collection_params()and allow Terms of a Post to be queried by term order.(props @danielbachhuber, [#1332][gh-1332])
-
Improve the Attachment error message for an invalid Content-Disposition
(props @danielbachhuber, [#1317][gh-1317])
-
Return 200 status when updating Attachments, Comments, and Users.
(props @rachelbaker, [#1348][gh-1348])
-
Remove unnecessary
handle_format_param()method.(props @danielbachhuber, [#1331][gh-1331])
-
Add
author_avatar_urlfield to the Comment response and schema.(props @rachelbaker [#1327][gh-1327])
-
Introduce
rest_do_request()for making REST requests internally.(props @danielbachhuber, [#1333][gh-1333])
-
Remove unused DateTime class.
(props @rmccue, [#1314][gh-1314])
-
Add inline documentation for
$wp_rest_serverglobal.(props @Shelob9, [#1324][gh-1324])
View all changes [gh-1245]: WP-API#1245 [gh-1314]: WP-API#1314 [gh-1317]: WP-API#1317 [gh-1318]: WP-API#1318 [gh-1324]: WP-API#1324 [gh-1326]: WP-API#1326 [gh-1327]: WP-API#1327 [gh-1331]: WP-API#1331 [gh-1332]: WP-API#1332 [gh-1333]: WP-API#1333 [gh-1345]: WP-API#1345 [gh-1346]: WP-API#1346 [gh-1347]: WP-API#1347 [gh-1348]: WP-API#1348
-
Load the WP REST API before the main query runs.
The
rest_api_loadedfunction now hooks into theparse_requestaction. This change prevents the main query from being run on every request and allows sites to setWP_USE_THEMEStofalse. Previously, the main query was always being run (SELECT * FROM wp_posts LIMIT 10), even though the result was never used and couldn't be cached.(props @rmccue, [#1270][gh-1270])
-
Register a new field on an existing WordPress object type.
Introduces
register_api_field()to add a field to an object and its schema.(props @joehoyle, @rachelbaker, [#927][gh-927]) (props @joehoyle, [#1207][gh-1207]) (props @joehoyle, [#1243][gh-1243])
-
Add endpoints for viewing, creating, updating, and deleting Terms for a Post.
The new
WP_REST_Posts_Terms_Controllerclass controller supports routes for Terms that belong to a Post.(props @joehoyle, @danielbachhuber, [#1216][gh-1216])
-
Add pagination headers for collection queries.
The
X-WP-TotalandX-WP-TotalPagesare now present in terms, comments, and users collection responses.(props @danielbachhuber, [#1182][gh-1182]) (props @danielbachhuber, [#1191][gh-1191]) (props @danielbachhuber, @joehoyle, [#1197][gh-1197])
-
List registered namespaces in the index for feature detection.
The index (
/wp-jsonby default) now contains a list of the available namespaces. This allows for simple feature detection. You can grab the index and check namespaces forwp/v3orpluginname/v2, which indicate the supported endpoints on the site.(props @rmccue,, [#1283][gh-1283])
-
Standardize link property relations and support embedding for all resources.
Change link properties to use IANA-registered relations. Also adds embedding support to Attachments, Comments and Terms.
(props @rmccue, @rachelbaker, [#1284][gh-1284])
-
Add support for Composer dependency management.
Allows you to recursively install/update the WP REST API inside of WordPress plugins or themes.
(props @QWp6t, [#1157][gh-1157])
-
Return full objects in the delete response.
Instead of returning a random message when deleting a Post, Comment, Term, or User provide the original resource data.
(props @danielbachhuber, [#1253][gh-1253]) (props @danielbachhuber, [#1254][gh-1254]) (props @danielbachhuber, [#1255][gh-1255]) (props @danielbachhuber, [#1256][gh-1256])
-
Return programmatically readable error messages for invalid or missing required parameters.
(props @joehoyle, [#1175][gh-1175])
-
Declare supported arguments for Comment and User collection queries.
(props @danielbachhuber, [#1211][gh-1211]) (props @danielbachhuber, [#1217][gh-1217])
-
Automatically validate parameters based on Schema data.
(props @joehoyle, [#1128][gh-1128])
-
Use the
show_in_restattributes for exposing Taxonomies.(props @joehoyle, [#1279][gh-1279])
-
Handle
parentwhen creating or updating a Term.(props @joehoyle, [#1221][gh-1221])
-
Limit fields returned in
embedcontext User responses.(props @rachelbaker, [#1251][gh-1251])
-
Only include
parentin term response when tax is hierarchical.(props @danielbachhuber, [#1189][gh-1189])
-
Fix bug in creating comments if
typewas not set.(props @rachelbaker, [#1244][gh-1244])
-
Rename
post_namefield topost_slug.(props @danielbachhuber, [#1235][gh-1235])
-
Add check when creating a user to verify the provided role is valid.
(props @rachelbaker, [#1267][gh-1267])
-
Add link properties to the Post Status response.
(props @joehoyle, [#1243][gh-1243])
-
Return
0forparentin Post response instead ofnull.(props @danielbachhuber, [#1269][gh-1269])
-
Only link
authorwhen there's a valid author(props @danielbachhuber, [#1203][gh-1203])
-
Only permit querying by parent term when tax is hierarchical.
(props @danielbachhuber, [#1219][gh-1219])
-
Only permit deleting posts of the proper type
(props @danielbachhuber, [#1257][gh-1257])
-
Set pagination headers even when no found posts.
(props @danielbachhuber, [#1209][gh-1209])
-
Correct prefix in
rest_request_parameter_orderfilter.(props @quasel, [#1158][gh-1158])
-
Retool
WP_REST_Terms_Controllerto follow Posts controller pattern.(props @danielbachhuber, [#1170][gh-1170])
-
Remove unused
accept_json argumentfrom theregister_routesmethod.(props @quasel, [#1160][gh-1160])
-
Fix typo in
sanitize_paramsinline documentation.(props @Shelob9, [#1226][gh-1226])
-
Remove commented out code in dispatch method.
(props @rachelbaker, [#1162][gh-1162])
View all changes [gh-927]: WP-API#927 [gh-1128]: WP-API#1128 [gh-1157]: WP-API#1157 [gh-1158]: WP-API#1158 [gh-1160]: WP-API#1160 [gh-1162]: WP-API#1162 [gh-1168]: WP-API#1168 [gh-1170]: WP-API#1170 [gh-1171]: WP-API#1171 [gh-1175]: WP-API#1175 [gh-1176]: WP-API#1176 [gh-1177]: WP-API#1177 [gh-1181]: WP-API#1181 [gh-1182]: WP-API#1182 [gh-1188]: WP-API#1188 [gh-1189]: WP-API#1189 [gh-1191]: WP-API#1191 [gh-1197]: WP-API#1197 [gh-1200]: WP-API#1200 [gh-1203]: WP-API#1203 [gh-1207]: WP-API#1207 [gh-1209]: WP-API#1209 [gh-1210]: WP-API#1210 [gh-1211]: WP-API#1211 [gh-1216]: WP-API#1216 [gh-1217]: WP-API#1217 [gh-1219]: WP-API#1219 [gh-1221]: WP-API#1221 [gh-1226]: WP-API#1226 [gh-1235]: WP-API#1235 [gh-1243]: WP-API#1243 [gh-1244]: WP-API#1244 [gh-1249]: WP-API#1249 [gh-1251]: WP-API#1251 [gh-1253]: WP-API#1253 [gh-1254]: WP-API#1254 [gh-1255]: WP-API#1255 [gh-1256]: WP-API#1256 [gh-1257]: WP-API#1257 [gh-1259]: WP-API#1259 [gh-1267]: WP-API#1267 [gh-1268]: WP-API#1268 [gh-1269]: WP-API#1269 [gh-1270]: WP-API#1270 [gh-1276]: WP-API#1276 [gh-1277]: WP-API#1277 [gh-1279]: WP-API#1279 [gh-1283]: WP-API#1283 [gh-1284]: WP-API#1284 [gh-1295]: WP-API#1295 [gh-1301]: WP-API#1301
-
Fix user access security vulnerability.
Authenticated users were able to escalate their privileges bypassing the expected capabilities check.
Reported by @kacperszurek on 2015-05-16.
-
Avoid passing server to the controller each time
(props @rmccue, [#543][gh-543])
-
Unify naming of methods across classes
(props @danielbachhuber, [#546][gh-546])
-
Disable unit tests while we move things around
(props @danielbachhuber, [#548][gh-548])
-
Mock code to represent new Resources
(props @danielbachhuber, [#549][gh-549])
-
WP_JSON_Controller POC
(props @danielbachhuber, [#556][gh-556])
-
Add request object
(props @rmccue, [#563][gh-563])
-
Update routes for new-style registration
(props @rmccue, [#564][gh-564])
-
Add compatibility with v1 routing
(props @rmccue, [#565][gh-565])
-
Remove Last-Modified and If-Unmodified-Since
(props @rmccue, [#566][gh-566])
-
Allow multiple route registration
(props @rmccue, [#586][gh-586])
-
Use https in test setup
(props @danielbachhuber, [#588][gh-588])
-
Terms Controller Redux
(props @danielbachhuber, [#579][gh-579])
-
Add hypermedia functionality to the response
(props @rmccue, @rachelbaker, [#570][gh-570])
-
Initial pass at new style Users Controller
(props @rachelbaker, [#603][gh-603])
-
Drop old Users class
(props @danielbachhuber, [#619][gh-619])
-
Fix passing array to 'methods' are in register_json_route()
(props @joehoyle, [#620][gh-620])
-
Allow 'ignore_sticky_posts' filter #415
(props @Shelob9, [#612][gh-612], [#415][gh-415])
-
Initial Extras.php commit
(props @NikV, [#575][gh-575])
-
Allow filtering response before returning
(props @danielbachhuber, [#573][gh-573])
-
Parse JSON data from the request
(props @rmccue, [#626][gh-626])
-
Remove old taxonomies controller
(props @danielbachhuber, [#637][gh-637])
-
Make our code DRY by consolidating use of strtoupper
(props @danielbachhuber, [#589][gh-589])
-
Move WP_Test_JSON_Testcase to a properly named file
(props @danielbachhuber, [#643][gh-643])
-
Speed up builds by only running against MS once
(props @danielbachhuber, [#638][gh-638])
-
->prepare_post()should be public(props @staylor, [#645][gh-645])
-
Get by and return
term_taxonomy_id(props @danielbachhuber, [#648][gh-648])
-
Base class with standard test methods for every controller
(props @danielbachhuber, [#649][gh-649])
-
Unused arguments
(props @staylor, [#647][gh-647])
-
JS should be under version control
(props @staylor, [#644][gh-644])
-
Register multiple routes for users correctly
(props @rmccue, [#654][gh-654])
-
Check get_post_type_object() returns an object before using it
(props @NateWr, [#656][gh-656])
-
Run multisite test against PHP 5.2
(props @danielbachhuber, [#659][gh-659])
-
Pass the edit context when returning the create or update response. Fixes #661
(props @rachelbaker, [#664][gh-664], [#661][gh-661])
-
Check for errors when responding to create
(props @rmccue, [#652][gh-652])
-
Fix bug in check_required_parameters where JSON params were missed
(props @rachelbaker, [#673][gh-673])
-
Fix parameter handling and improve Users Controller tests
(props @rachelbaker, [#675][gh-675])
-
Check that param is null
(props @danielbachhuber, [#678][gh-678])
-
Parse URL-encoded body with PUT requests
(props @rmccue, [#681][gh-681])
-
End to end testing for users
(props @rmccue, [#682][gh-682])
-
End to end test coverage of Terms Controller
(props @danielbachhuber, @rmccue, [#676][gh-676])
-
Add ability to wrap response in an envelope
(props @Japh, @rmccue, [#628][gh-628])
-
Wrap up PUT handling in Users Controller
(props @rachelbaker, [#683][gh-683])
-
ID shouldn't be a param on update user endpoint
(props @joehoyle, [#692][gh-692])
-
Clean up Terms controller
(props @danielbachhuber, [#696][gh-696])
-
Remove mis-placed duplicate Users Delete route and id parameter
(props @rachelbaker, [#700][gh-700])
-
Fields cleanup for User controller
(props @danielbachhuber, [#701][gh-701])
-
Throw an error when a user tries to update to an existing user's email
(props @danielbachhuber, [#705][gh-705])
-
PUT Usershouldn't permit using existinguser_loginoruser_nicename(props @danielbachhuber, [#707][gh-707])
-
Change return value of WP_JSON_Users_Controller::get_item.
(props @rachelbaker, [#712][gh-712])
-
Add the ability to specify default param values in register_json_route
(props @WP-API, [#715][gh-715])
-
Merge JS into main repo
(props @tlovett1, #730)
-
Make the "required" param on args optional
(props @joehoyle, @rachelbaker, [#728][gh-728])
-
Always allow JSON data for POST and PUT requests
(props @rachelbaker, [#731][gh-731])
-
Initial pass at new style Posts Controller
(props @rachelbaker, [#684][gh-684])
-
Drop required argument declaration
(props @danielbachhuber, [#736][gh-736])
-
Update post format after post has been updated
(props @danielbachhuber, [#737][gh-737])
-
Allow the title to be set via title.raw
(props @iseulde, [#741][gh-741])
-
Fix some incompatible interfaces
(props @staylor, [#742][gh-742])
-
Full Test Coverage for Users Controller
(props @rachelbaker, [#744][gh-744])
-
Refer to BaseCollection statically instead of via this.constructor
(props @tlovett1, [#750][gh-750])
-
Adjustments to Users Controller DocBlocks
(props @rachelbaker, [#743][gh-743])
-
Default
argsto an empty array(props @danielbachhuber, [#758][gh-758])
-
Do not require type parameter to be set when updating a Post
(props @rachelbaker, [#761][gh-761])
-
Remove from docs the "post_type" filter parameter for /posts endpoint
(props @NateWr, [#666][gh-666])
-
Resolve regressions in Posts Controller
(props @rachelbaker, [#753][gh-753])
-
WP_Json_Server::dispatch() should always return a WP_JSON_Response
(props @joehoyle, [#714][gh-714])
-
Update Timeline note
(props @tapsboy, [#774][gh-774])
-
Make json_pre_dispatch and json_post_dispatch consistent
(props @joehoyle, [#786][gh-786])
-
Normalize our test classes setUP and tearDown methods
(props @rachelbaker, [#794][gh-794])
-
Comments Endpoints
(props @joehoyle, @rachelbaker, [#693][gh-693])
-
Correct /posts/ endpoint read post permission logic
(props @rachelbaker, [#805][gh-805])
-
Ensure global $post has proper state when the json_prepare_post filter f...
(props @ericandrewlewis, [#823][gh-823])
-
Adds missing description field to the Taxonomy response
(props @rachelbaker, [#826][gh-826])
-
Posts controller abstraction
(props @danielbachhuber, [#820][gh-820])
-
Remove old Pages and CustomPostType classes no longer in use
(props @danielbachhuber, [#831][gh-831])
-
Add
featured_imageattribute for post types that supportthumbnails(props @danielbachhuber, [#832][gh-832])
-
Specify Capability in Route
(props @joehoyle, [#602][gh-602])
-
Posts Controller Headers and Links Fixes
(props @rachelbaker, [#836][gh-836])
-
Don't noop
futurestatus. It's confusing(props @danielbachhuber, [#841][gh-841])
-
Remove unused $request parameter from prepare_links method.
(props @rachelbaker, [#842][gh-842])
-
Expose basic author details when user has published posts
(props @danielbachhuber, [#838][gh-838])
-
Make
get_post_type_base()public so we can DRY(props @danielbachhuber, [#845][gh-845])
-
Remove Duplicate Logic for Post Type Attributes
(props @rachelbaker, [#853][gh-853])
-
Move infrastructure classes to
lib/infrastructure, part one(props @danielbachhuber, [#872][gh-872])
-
Passing a value for the slug parameter should update the post_name.
(props @rachelbaker, [#883][gh-883])
-
Break Pages tests into a separate class
(props @danielbachhuber, [#870][gh-870])
-
Empty checks in Posts Controller make setting values to Falsy impossible
(props @joehoyle, [#885][gh-885])
-
Change project name to WP REST API in plugin name and Readme title.
(props @rachelbaker, [#876][gh-876])
-
Return 200 and an empty array for valid queries with 0 results.
(props @rachelbaker, [#888][gh-888])
-
Include the taxonomy in the term response
(props @danielbachhuber, [#891][gh-891])
-
JSON Schemas for our Controllers, second attempt
(props @danielbachhuber, [#844][gh-844])
-
From the left with love
(props @MichaelArestad, [#896][gh-896])
-
Add
linkfield to Users, Comments and Terms(props @danielbachhuber, [#897][gh-897])
-
Fix flipped assertions
(props @danielbachhuber, [#902][gh-902])
-
Add missing break statement
(props @danielbachhuber, [#905][gh-905])
-
Move all of our endpoint controllers to
lib/endpoints(props @danielbachhuber, [#906][gh-906])
-
Always include
guidin Post and Page schemas(props @danielbachhuber, [#907][gh-907])
-
If post type doesn't match controller post type, throw 404
(props @danielbachhuber, [#908][gh-908])
-
Allow post type attributes to be set based on presence in schema
(props @danielbachhuber, [#910][gh-910])
-
Updating another post field shouldn't change sticky status
(props @danielbachhuber, [#911][gh-911])
-
Expose post type data at
/types(props @danielbachhuber, [#914][gh-914])
-
Always defer to controller for post type
(props @danielbachhuber, [#913][gh-913])
-
Add
templateparameter to Page response(props @danielbachhuber, [#909][gh-909])
-
Convert /media to new controller pattern
(props @danielbachhuber, [#904][gh-904])
-
Remove v1.0 Posts (and Media) controller
(props @WP-API, [#923][gh-923])
-
Clean up taxonomies controller tests by running through dispatch; add schema
(props @danielbachhuber, [#919][gh-919])
-
Separate permissions logic for comments
(props @joehoyle, [#854][gh-854])
-
wp-json.phpisn't needed anymore(props @danielbachhuber, [#931][gh-931])
-
Tweak the post controller
(props @rmccue, [#936][gh-936])
-
Switch CORS headers callback to new action
(props @rmccue, [#935][gh-935])
-
Remove
_idsuffix from field names(props @danielbachhuber, [#941][gh-941])
-
Add
author_ip,author_user_agentandkarmafields to Comment(props @danielbachhuber, [#946][gh-946])
-
Explicitly test that these additional comment fields aren't present
(props @danielbachhuber, [#947][gh-947])
-
Allow
titleto be set to empty string in request(props @danielbachhuber, [#953][gh-953])
-
Use real URLs instead of query_params attribute
(props @rmccue, [#958][gh-958])
-
Use
wp_filter_post_kses()instead ofwp_kses_post()on insert(props @danielbachhuber, [#917][gh-917])
-
Add missing core path to post endpoint link hrefs.
(props @rachelbaker, [#966][gh-966])
-
Allow HTTP method to be overwritten by HTTP_X_HTTP_METHOD_OVERRIDE
(props @tlovett1, [#967][gh-967])
-
Fix attachment caption and description fields
(props @danielbachhuber, [#968][gh-968])
-
Move validation to the
WP_JSON_Requestclass(props @danielbachhuber, [#971][gh-971])
-
Move the Route Registering to the Controllers
(props @joehoyle, [#970][gh-970])
-
Correct test method spelling of permission.
(props @rachelbaker, [#973][gh-973])
-
Permission abstractions 2
(props @joehoyle, [#987][gh-987])
-
If an invalid date is supplied to create / update post, return an error
(props @joehoyle, [#1000][gh-1000])
-
Update README.md
(props @hubdotcom, [#1006][gh-1006])
-
Add embeddable attachments to Post response _links
(props @rachelbaker, [#1026][gh-1026])
-
Throw error if requesting user doesn't have capability for context
(props @danielbachhuber, [#1033][gh-1033])
-
/wp/statusesendpoint, modeled after/wp/types(props @danielbachhuber, [#1039][gh-1039])
-
Turn post types from array to object, with name as key
(props @danielbachhuber, [#1042][gh-1042])
-
Add missing response fields to the user schema.
(props @rachelbaker, [#1034][gh-1034])
-
Setting a post to be sticky AND password protected should fail
(props @joehoyle, [#1044][gh-1044])
-
Use appropriate functions when creating users on multisite
(props @danielbachhuber, [#1043][gh-1043])
-
Define context in which each schema field appears
(props @danielbachhuber, [#1046][gh-1046])
-
Use schema abstraction to limit which user fields are exposed per context
(props @danielbachhuber, [#1049][gh-1049])
-
Run Statuses, Types, and Taxonomies through our context filter
(props @danielbachhuber, [#1050][gh-1050])
-
Run Terms controller through schema context filter
(props @danielbachhuber, [#1051][gh-1051])
-
Don't allow contributors to set sticky on posts
(props @joehoyle, [#1052][gh-1052])
-
Return correct response code from wp_insert_post() error
(props @joehoyle, [#999][gh-999])
-
Move the permissions checks for password and author into the permissions callback
(props @joehoyle, [#1054][gh-1054])
-
Use full Post schema to filter fields based on context
(props @danielbachhuber, [#1053][gh-1053])
-
Allow WP_JSON_Server::send_header()/send_headers() to be accessed publicly
(props @johnbillion, [#1059][gh-1059])
-
Remove unnecessary sticky posts abstraction
(props @danielbachhuber, [#1064][gh-1064])
-
Re-enable the Post endpoint filters
(props @rachelbaker, [#1028][gh-1028])
-
Fix the format of the args when building them from the Schema
(props @joehoyle, [#1066][gh-1066])
-
Add more tests for the server class
(props @rmccue, [#685][gh-685])
-
Fix error with OPTIONS requests
(props @rmccue, [#1091][gh-1091])
-
Ensure the JSON endpoint URL is properly escaped
(props @johnbillion, [#1097][gh-1097])
-
Correct a bunch of filter docs in WP_JSON_Server
(props @johnbillion, [#1098][gh-1098])
-
Require
moderate_commentscapability to context=edit a Comment(props @danielbachhuber, @joehoyle, [#951][gh-951])
-
Add all the permission check functions to the base controller for better consistancy and help to subclasses
(props @joehoyle, [#1104][gh-1104])
-
authoris the Comment attribute with user ID(props @danielbachhuber, [#1106][gh-1106])
-
Fix copy pasta in the schema checks
(props @danielbachhuber, [#1111][gh-1111])
-
When
context=edit, confirm user canmanage_comments(props @danielbachhuber, [#1112][gh-1112])
-
Abstract revisions to dedicated controller; only include revisioned fields
(props @danielbachhuber, [#1110][gh-1110])
-
Add Embeddable Taxonomy Term Links to the Post Response
(props @rachelbaker, [#1048][gh-1048])
-
Increase Terms Controller test coverage
(props @rachelbaker, [#1117][gh-1117])
-
Rename the
wp_json_server_before_servetowp_json_init(props @joehoyle, [#1105][gh-1105])
-
Drop revision embedding from posts controller; link instead
(props @danielbachhuber, [#1121][gh-1121])
-
Add security section to our README
(props @rmccue, [#1123][gh-1123])
-
Missing @param inline docs in main plugin file.
(props @Shelob9, [#1122][gh-1122])
-
Ensure post deletion is idempotent
(props @rmccue, [#959][gh-959])
-
Support for validation / sanitize callbacks in arguments
(props @joehoyle, [#989][gh-989])
-
Display links in collections
(props @rmccue, @rachelbaker, [#937][gh-937])
-
Sanitize args using new args API
(props @joehoyle, [#1129][gh-1129])
-
Use the user fields from the item schema as the request args in route registration
(props @joehoyle, [#1109][gh-1109])
-
Build the array of args for /wp/posts from the allowed query vars
(props @joehoyle, [#1108][gh-1108])
-
Show all the invalid param errors at once
(props @joehoyle, [#1131][gh-1131])
-
Readonly attribute in schema to exclude from args array
(props @joehoyle, [#1133][gh-1133])
-
Use the
requiredflags from the schema for CREATE post(props @joehoyle, [#1132][gh-1132])
-
Only return 201 on Create. Update should be 200
(props @danielbachhuber, [#1142][gh-1142])
-
Convert meta endpoints to new-style
(props @rmccue, @rachelbaker, [#960][gh-960])
-
Specific error codes for permissions failures
(props @joehoyle, [#1148][gh-1148])
View all changes gh-347: WP-API#347 gh-378: WP-API#378 gh-401: WP-API#401 [gh-415]: WP-API#415 [gh-448]: WP-API#448 gh-474: WP-API#474 gh-481: WP-API#481 gh-524: WP-API#524 gh-528: WP-API#528 [gh-543]: WP-API#543 [gh-546]: WP-API#546 [gh-548]: WP-API#548 [gh-549]: WP-API#549 [gh-550]: WP-API#550 [gh-556]: WP-API#556 [gh-563]: WP-API#563 [gh-564]: WP-API#564 [gh-565]: WP-API#565 [gh-566]: WP-API#566 [gh-567]: WP-API#567 [gh-570]: WP-API#570 [gh-573]: WP-API#573 [gh-575]: WP-API#575 [gh-579]: WP-API#579 [gh-586]: WP-API#586 [gh-588]: WP-API#588 [gh-589]: WP-API#589 [gh-591]: WP-API#591 gh-595: WP-API#595 [gh-602]: WP-API#602 [gh-603]: WP-API#603 [gh-612]: WP-API#612 [gh-619]: WP-API#619 [gh-620]: WP-API#620 [gh-626]: WP-API#626 [gh-628]: WP-API#628 [gh-630]: WP-API#630 [gh-637]: WP-API#637 [gh-638]: WP-API#638 [gh-643]: WP-API#643 [gh-644]: WP-API#644 [gh-645]: WP-API#645 [gh-647]: WP-API#647 [gh-648]: WP-API#648 [gh-649]: WP-API#649 [gh-652]: WP-API#652 [gh-654]: WP-API#654 [gh-656]: WP-API#656 [gh-659]: WP-API#659 [gh-661]: WP-API#661 [gh-664]: WP-API#664 [gh-666]: WP-API#666 [gh-673]: WP-API#673 [gh-675]: WP-API#675 [gh-676]: WP-API#676 [gh-678]: WP-API#678 [gh-681]: WP-API#681 [gh-682]: WP-API#682 [gh-683]: WP-API#683 [gh-684]: WP-API#684 [gh-685]: WP-API#685 [gh-692]: WP-API#692 [gh-693]: WP-API#693 [gh-696]: WP-API#696 [gh-700]: WP-API#700 [gh-701]: WP-API#701 [gh-705]: WP-API#705 [gh-707]: WP-API#707 [gh-712]: WP-API#712 [gh-714]: WP-API#714 [gh-715]: WP-API#715 [gh-722]: WP-API#722 [gh-728]: WP-API#728 gh-730: WP-API#730 [gh-731]: WP-API#731 [gh-736]: WP-API#736 [gh-737]: WP-API#737 [gh-741]: WP-API#741 [gh-742]: WP-API#742 [gh-743]: WP-API#743 [gh-744]: WP-API#744 [gh-750]: WP-API#750 [gh-753]: WP-API#753 [gh-758]: WP-API#758 [gh-761]: WP-API#761 [gh-774]: WP-API#774 [gh-786]: WP-API#786 [gh-794]: WP-API#794 [gh-805]: WP-API#805 [gh-807]: WP-API#807 [gh-815]: WP-API#815 [gh-820]: WP-API#820 [gh-823]: WP-API#823 [gh-826]: WP-API#826 [gh-831]: https://github.com/WP-API/WP-API/issues/831 [gh-832]: https://github.com/WP-API/WP-API/issues/832 [gh-836]: https://github.com/WP-API/WP-API/issues/836 [gh-838]: https://github.com/WP-API/WP-API/issues/838 [gh-841]: https://github.com/WP-API/WP-API/issues/841 [gh-842]: https://github.com/WP-API/WP-API/issues/842 [gh-844]: https://github.com/WP-API/WP-API/issues/844 [gh-845]: https://github.com/WP-API/WP-API/issues/845 [gh-849]: https://github.com/WP-API/WP-API/issues/849 [gh-853]: https://github.com/WP-API/WP-API/issues/853 [gh-854]: https://github.com/WP-API/WP-API/issues/854 [gh-870]: https://github.com/WP-API/WP-API/issues/870 [gh-872]: https://github.com/WP-API/WP-API/issues/872 [gh-874]: https://github.com/WP-API/WP-API/issues/874 [gh-876]: https://github.com/WP-API/WP-API/issues/876 [gh-879]: https://github.com/WP-API/WP-API/issues/879 [gh-883]: https://github.com/WP-API/WP-API/issues/883 [gh-885]: https://github.com/WP-API/WP-API/issues/885 [gh-888]: https://github.com/WP-API/WP-API/issues/888 [gh-891]: https://github.com/WP-API/WP-API/issues/891 [gh-896]: https://github.com/WP-API/WP-API/issues/896 [gh-897]: https://github.com/WP-API/WP-API/issues/897 [gh-902]: https://github.com/WP-API/WP-API/issues/902 [gh-904]: https://github.com/WP-API/WP-API/issues/904 [gh-905]: https://github.com/WP-API/WP-API/issues/905 [gh-906]: https://github.com/WP-API/WP-API/issues/906 [gh-907]: https://github.com/WP-API/WP-API/issues/907 [gh-908]: https://github.com/WP-API/WP-API/issues/908 [gh-909]: https://github.com/WP-API/WP-API/issues/909 [gh-910]: https://github.com/WP-API/WP-API/issues/910 [gh-911]: https://github.com/WP-API/WP-API/issues/911 [gh-913]: https://github.com/WP-API/WP-API/issues/913 [gh-914]: https://github.com/WP-API/WP-API/issues/914 [gh-917]: https://github.com/WP-API/WP-API/issues/917 [gh-919]: https://github.com/WP-API/WP-API/issues/919 [gh-923]: https://github.com/WP-API/WP-API/issues/923 [gh-931]: https://github.com/WP-API/WP-API/issues/931 gh-933: https://github.com/WP-API/WP-API/issues/933 [gh-935]: https://github.com/WP-API/WP-API/issues/935 [gh-936]: https://github.com/WP-API/WP-API/issues/936 [gh-937]: https://github.com/WP-API/WP-API/issues/937 [gh-941]: https://github.com/WP-API/WP-API/issues/941 [gh-946]: https://github.com/WP-API/WP-API/issues/946 [gh-947]: https://github.com/WP-API/WP-API/issues/947 [gh-951]: https://github.com/WP-API/WP-API/issues/951 [gh-953]: https://github.com/WP-API/WP-API/issues/953 [gh-955]: https://github.com/WP-API/WP-API/issues/955 [gh-958]: https://github.com/WP-API/WP-API/issues/958 [gh-959]: https://github.com/WP-API/WP-API/issues/959 [gh-960]: https://github.com/WP-API/WP-API/issues/960 [gh-966]: https://github.com/WP-API/WP-API/issues/966 [gh-967]: https://github.com/WP-API/WP-API/issues/967 [gh-968]: https://github.com/WP-API/WP-API/issues/968 [gh-970]: https://github.com/WP-API/WP-API/issues/970 [gh-971]: https://github.com/WP-API/WP-API/issues/971 [gh-973]: https://github.com/WP-API/WP-API/issues/973 gh-985: https://github.com/WP-API/WP-API/issues/985 [gh-987]: https://github.com/WP-API/WP-API/issues/987 [gh-989]: https://github.com/WP-API/WP-API/issues/989 [gh-996]: https://github.com/WP-API/WP-API/issues/996 [gh-999]: https://github.com/WP-API/WP-API/issues/999 [gh-1000]: https://github.com/WP-API/WP-API/issues/1000 [gh-1006]: https://github.com/WP-API/WP-API/issues/1006 [gh-1026]: https://github.com/WP-API/WP-API/issues/1026 [gh-1028]: https://github.com/WP-API/WP-API/issues/1028 [gh-1033]: https://github.com/WP-API/WP-API/issues/1033 [gh-1034]: https://github.com/WP-API/WP-API/issues/1034 [gh-1039]: https://github.com/WP-API/WP-API/issues/1039 [gh-1042]: https://github.com/WP-API/WP-API/issues/1042 [gh-1043]: https://github.com/WP-API/WP-API/issues/1043 [gh-1044]: https://github.com/WP-API/WP-API/issues/1044 [gh-1046]: https://github.com/WP-API/WP-API/issues/1046 [gh-1048]: https://github.com/WP-API/WP-API/issues/1048 [gh-1049]: https://github.com/WP-API/WP-API/issues/1049 [gh-1050]: https://github.com/WP-API/WP-API/issues/1050 [gh-1051]: https://github.com/WP-API/WP-API/issues/1051 [gh-1052]: https://github.com/WP-API/WP-API/issues/1052 [gh-1053]: https://github.com/WP-API/WP-API/issues/1053 [gh-1054]: https://github.com/WP-API/WP-API/issues/1054 [gh-1059]: https://github.com/WP-API/WP-API/issues/1059 [gh-1064]: https://github.com/WP-API/WP-API/issues/1064 [gh-1066]: https://github.com/WP-API/WP-API/issues/1066 [gh-1091]: https://github.com/WP-API/WP-API/issues/1091 [gh-1097]: https://github.com/WP-API/WP-API/issues/1097 [gh-1098]: https://github.com/WP-API/WP-API/issues/1098 [gh-1103]: https://github.com/WP-API/WP-API/issues/1103 [gh-1104]: https://github.com/WP-API/WP-API/issues/1104 [gh-1105]: https://github.com/WP-API/WP-API/issues/1105 [gh-1106]: https://github.com/WP-API/WP-API/issues/1106 [gh-1108]: https://github.com/WP-API/WP-API/issues/1108 [gh-1109]: https://github.com/WP-API/WP-API/issues/1109 [gh-1110]: https://github.com/WP-API/WP-API/issues/1110 [gh-1111]: https://github.com/WP-API/WP-API/issues/1111 [gh-1112]: https://github.com/WP-API/WP-API/issues/1112 [gh-1115]: https://github.com/WP-API/WP-API/issues/1115 [gh-1116]: https://github.com/WP-API/WP-API/issues/1116 [gh-1117]: https://github.com/WP-API/WP-API/issues/1117 [gh-1121]: https://github.com/WP-API/WP-API/issues/1121 [gh-1122]: https://github.com/WP-API/WP-API/issues/1122 [gh-1123]: https://github.com/WP-API/WP-API/issues/1123 [gh-1129]: https://github.com/WP-API/WP-API/issues/1129 [gh-1131]: https://github.com/WP-API/WP-API/issues/1131 [gh-1132]: https://github.com/WP-API/WP-API/issues/1132 [gh-1133]: https://github.com/WP-API/WP-API/issues/1133 [gh-1134]: https://github.com/WP-API/WP-API/issues/1134 [gh-1137]: https://github.com/WP-API/WP-API/issues/1137 [gh-1142]: https://github.com/WP-API/WP-API/issues/1142 [gh-1148]: https://github.com/WP-API/WP-API/issues/1148
-
Fix information disclosure security vulnerability.
Unauthenticated users could access revisions of published and unpublished posts. Revisions are now only accessible to authenticated users with permission to edit the revision's post.
Reported by @chredd on 2015-04-09.
-
Add handling for Cross-Origin Resource Sharing (CORS) OPTIONS requests.
Preflighted requests (using the OPTIONS method) include the headers
Access-Control-Allow-Origin,Access-Control-Allow-Methods, andAccess-Control-Allow-Credentialsin the response, if the HTTP origin is set.(props @rmccue, #281)
-
Allow overriding full requests.
The
json_pre_dispatchfilter allows a request to be hijacked before it is dispatched. Hijacked requests can be anything a normal endpoint can return.(props @rmccue, #281)
-
Check for JSON encoding/decoding errors.
Returns the last error (if any) occurred during the last JSON encoding or decoding operation.
(props @joshkadis, @rmccue, #461)
-
Add filtering to the terms collection endpoint.
Available filter arguments are based on the
get_terms()function. Example:/taxonomies/category/terms?filter[number]=10would limit the response to 10 category terms. -
Add handling for the
roleparameter when creating or updating a user.Allow users to be created or updated with a provided
role. -
Add handling for the
post_idparameter when creating media.Allow passing the
post_idparameter to associate a new media item with a post.(props @pkevan, #294)
-
Handle route matching for
-in taxonomy and terms.Previously the regular expression used to match taxonomy and term names did not support names with dashes.
(props @EdHurtig, @evansobkowicz, #410)
-
Handle JSONP callback matching for
.in the function name.Previously the regular expression used to match JSONP callback functions did not support names with periods.
(props @codonnell822, #455)
-
Fix the Content-Type header for JSONP requests.
Previously JSONP requests sent the incorrect
application/jsonContent-Type header with the response. This would result in an error if strict MIME checking was enabled. The Content-Type header was corrected toapplication/javascriptfor JSONP responses.(props @simonlampen, #380)
-
Add
$contextparameter tojson_prepare_termfilter.Terms responses can now be modified based on the
contextparameter of the request.(props @traversal, #316)
-
Move the JavaScript client library into the plugin.
Previously, the
wp-api.jsfile was a separate repository. The JavaScript client has moved back into the plugin to coordinate code changes.(props @tlovett1, #730)
-
Always return an object for media sizes
The media sizes value should always be an object even when empty. Previously, if a media item did not have any sizes set, an empty array was returned.
Compatibility warning: Clients should be prepared to accept an empty object as a value for media sizes.
(props @maxcutler, #300)
-
Give top-level posts a
nullparent value.For date type consistency, post parent property should be
null. Previously, parent-less posts returned0for parent.Compatibility warning: Clients should be prepared to accept
nullas a value for post parent.(props @maxcutler, #391)
-
Move permission checks out of
WP_JSON_Posts.Introduce
json_check_post_permission()function to allow post object capability checks to be used outside theWP_JSON_Postsclass.Deprecation warning: Calling
WP_JSON_Posts::check_read_permissionandWP_JSON_Posts::check_edit_permissionis now deprecated. -
Split comment endpoints into separate class.
All comment handling has moved to the
WP_JSON_Commentsclass.Deprecation warning: Calling
WP_JSON_Posts::get_comments,WP_JSON_Posts::get_comment,WP_JSON_Posts::delete_comment, andWP_JSON_Posts::prepare_commentis now deprecated.(props @whyisjake, @rmccue, @rachelbaker, #378)
-
Split meta endpoints into separate class.
All post meta handling has moved to the new
WP_JSON_Meta_Postsclass.Deprecation warning: Calling
WP_JSON_Posts::get_all_meta,WP_JSON_Posts::get_meta,WP_JSON_Posts::update_meta,WP_JSON_Posts::add_meta,WP_JSON_Posts::delete_meta,WP_JSON_Posts::prepare_meta, andWP_JSON_Posts::is_valid_meta_datais now deprecated. -
Rename internal create methods.
Deprecation warning: Calling
WP_JSON_Posts::new_post,WP_JSON_CustomPostType::new_postandWP_JSON_Posts::new_postis now deprecated. -
Fix discrepancies in edit and create posts documentation examples.
Corrected the edit and create posts code examples in the Getting Started section. The new post example was updated to include the required
content_rawparameter. The new and edit posts examples were updated to use a correct date parameter.(props @rachelbaker, #305)
-
Update the cookie authentication documentation examples.
With 1.1 the localized JavaScript object for
wp-api.jschanged toWP_API_Settings. This updates the Authentication section documentation nonce example to use the updated object name.(props @rachelbaker, #321)
-
Add flexibility and multisite support to unit tests.
Tests can be run from any WordPress install, and are not limited to only as a plugin installed within a WordPress.org develop checkout. Unit tests are now run against a multisite installation.
(props @danielbachhuber, #397)
-
Add
taxonomyslug to the term response.(props @kalenjohnson, #481)
-
Fix error when getting child comment.
Previously an error occurred when a requested comment had a parent.
-
Parse query strings before returning a JSON decode error.
(props @jtsternberg, #499)
-
Typecast the user ID parameter to be an integer for the
/users/{ID}route.(props @dimadin, #333)
-
Confirm a given JSONP callback is a string.
(props @ircrash, @rmccue, #405)
-
Register the JavaScript client in the admin.
(props @tlovett1, #473)
-
Remove duplicate error checks on post ids.
(props @danielbachhuber, #271)
-
Update documentation link references to wp-api.org.
(props @pollyplummer, #320)
-
Update documentation to note routes needing authentication.
-
Correct Post route documentation filter parameters.
-
Update taxonomy route documentation with correct paths.
-
Remove references to legacy
$fieldsparameter.(props @JDGrimes, #326)
-
Alter readme installation steps to use wp-cli for plugin and permalink setup.
(props @kadamwhite, #390)
-
Add steps to readme for executing tests with
vagrant ssh -c.(props @kadamwhite, #416)
-
Update readme to include provision step for testing suite.
(props @ironpaperweight, #396)
-
Update readme Getting Started link.
(props @NikV, #519)
-
Update readme Chassis repository links.
(props @Japh, #505)
-
Clean-up of
docsfolder.(props @pollyplummer, #441)
-
Documentation audit for plugin.php file.
(props @DrewAPicture, #293)
-
Rename tests to match class file naming.
(props @danielbachhuber, @rmccue, #359)
-
Add license.txt file with license terms.
-
Fix test_root when using WordPress.org developer checkout.
(props @markoheijnen, #437)
-
Mitigate Flash CSRF exploit
Using the API's JSONP support, it's possible to control the first bytes of the response sent to the browser. Combining this with an ASCII-encoded SWF allows arbitrary SWFs to be served from the site, allowing bypassing the same-origin policy built in to browsers.
While the API includes CSRF protection and is not directly vulnerable, this can be used to bypass other browser origin controls.
Reported by @iandunn on 2014-07-10.
(props @iandunn, @rmccue, #356)
-
Add new routes for taxonomies and terms.
Taxonomies and terms have now been moved from the
/posts/types/<type>namespace to global routes:/taxonomies,/taxonomies/<tax>,/taxonomies/<tax>/termsand/taxonomies/<tax>/terms/<term>Test coverage for taxonomy endpoints has also been increased to 100%.
Deprecation warning: The
/posts/types/<type>/taxonomiesendpoint (and sub-endpoints with the same prefix) have been deprecated in favour of the new endpoints. These deprecated endpoints will now return aX-WP-DeprecatedFunctionheader indicating that the endpoint should not be used for new development, but will continue to work in the future. -
Allow customizing the API resources prefix
The API base (typically
wp-json/) can now be customized to a different prefix using thejson_url_prefixfilter. Note that rewrites will need to be flushed manually after changing this. -
Give
nullas date for draft posts.Draft posts would previously return "0000-00-00 00:00:00" or "1970-01-01T00:00:00", as draft posts are not assigned a publish date. The API now returns
nullwhere a date is not available.Compatibility warning: Clients should be prepared to accept
nullas a value for date/time fields, and treat it as if no value is set. -
Fix errors with excerpt.
Posts without excerpts could previously return nonsense strings, excerpts from other posts, or cause internal PHP errors. Posts without excerpts will now always return an excerpt, typically automatically generated from the post content.
The
excerpt_rawfield was added to the edit context on posts. This field contains the raw excerpt data saved for the post, including empty string values. -
Only expose email for edit context.
User email addresses are now only exposed for
context=edit, which requires theedit_userspermission (not required for the current user).The email address field will now return
falseinstead of a string if the field is not exposed. -
Correct password-protected post handling.
Password-protected posts could previously be exposed to all users, however could also have broken behaviour with excerpts. Password-protected posts are now hidden to unauthenticated users, while content and excerpts are shown correctly for the
editcontext.(Note that hiding password-protected posts is intended to be a temporary measure, and will likely change in the future.)
-
Add documentation on authentication methods.
Full documentation on authentication is now available. This documentation explains the difference between the various available authentication methods, and notes which should be used.
(props @rmccue, #242)
-
Include new client JS from github.io
The WP-API Javascript library is now loaded dynamically from
wp-api.github.ioto ensure it is always up-to-date. -
Don't allow setting the modification date on post creation/update.
As it turns out, WP core doesn't allow us to set this, so this was previously a no-op anyway. Discovered during test coverage phase.
-
Check post parent correctly on insertion.
Posts could previously be added with an invalid parent ID. These IDs are now checked to ensure the post exists.
-
Make sure the type is actually evaluated for
json_prepare_${type}filter.This value was previously not interpolated correctly, due to the use of the single-quoted string type.
(props @danielbachhuber, #266)
-
Return
WP_Errorinstead of array of empty objects for a revisions permissions error.Previously, when trying to access post revisions without correct permissions, a JSON list of internal error objects would be returned. This has been corrected to return a standard API error instead.
-
Flip user parameters check for insert/update.
Previously, you could add a user without specifying username/password/email, but couldn't update a user without those parameters. The logic has been inverted here instead.
-
Add revision endpoints tests
(props @danielbachhuber, @rachelbaker, @rmccue, #275, #277, #284, #279)
-
Add post endpoint testing
Now at >54% coverage for the whole class, and >80% for the main methods. This figure will continue to rise over the next few releases.
(props @rachelbaker, @rmccue, #99)
-
Separate helper functions into global namespace.
WP_JSON_Server::get_timezone(),WP_JSON_Server::get_date_with_gmt(),WP_JSON_Server::get_avatar_url()and ``WP_JSON_Server::parse_date()` have all been moved into the global namespace to decouple them from the server class.Deprecation warning: These methods have been deprecated. The new
json_get_timezone(),json_get_date_with_gmt(),json_get_avatar_url()andjson_parse_date()methods should now be used instead. -
Re-order Users and Media routes documentation based on CRUD order
(props @rachelbaker, #214)
-
Update Post route documentation to provide more detail for data parameter
(props @rachelbaker, #212)
-
Correct documentation typo ("inforcement" -> "enforcement").
(props @ericandrewlewis, #236)
-
Coding Standards audit
(props @DrewAPicture, #235)
-
Add comparison documentation.
-
json_urlfilter call should be passed$scheme(props @ericandrewlewis, #243)
-
Set
class-jsonserializable.phpfile mode to 644.(props @jeremyfelt, #255)
-
Remove unneeded "which" in implementation doc.
(props @JDGrimes, #254)
-
Fix a copy/paste error in schema doc.
(props @JDGrimes, #253)
-
Correct reference link in example schema.
(props @danielbachhuber, #258)
-
Add missing post formats to post schema documentation.
(props @danielbachhuber, #260)
-
Ensure we always use "public" on public methods.
(props @danielbachhuber, #268)
-
Ensure we don't cause a PHP error if a post does not have revisions.
(props @rmccue, #227)
-
Add note to where upload_files cap comes from
(props @pkevan, #282)
-
Add handling of
stickyproperty when creating or editing posts.(props @rachelbaker, #218)
-
Update post route endpoint docs to include details on
post_metahandling.(props @rachelbaker, #213)
-
Update main readme file to better describe the project.
(props @rmccue, #303)
-
Fix
--data-binarycURL option in documentation
-
Add user endpoints.
Creating, reading, updating and deleting users and their data is now possible by using the
/usersendpoints./users/mecan be used to determine the current user, and returns a 401 status for non-logged in users.Note that the format of post authors has changed, as it is now an embedded User entity. This should not break backwards compatibility.
Custom post types gain this ability automatically.
-
Add post meta endpoints.
Creating, reading, updating and deleting post meta is now possible by using the
/posts/<id>/metaendpoints. Post meta is now correctly embedded into Post entities.Meta can be updated via the Post entity (e.g.
PUTto/posts/<id>) or via the entity itself at/posts/<id>/meta/<mid>. Meta deletion must be done via aDELETErequest to the latter.Only non-protected and non-serialized meta can be accessed or manipulated via the API. This is not predicted to change in the future; clients wishing to access this data should consider alternative approaches.
Custom post types do not currently gain this ability automatically.
(props @attitude, @alisspers, @rachelbaker, @rmccue, @tlovett1, @tobych, @zedejose, #68, #168, #189, #207)
-
Add endpoint for deleting a single comment.
Clients can now send a
DELETErequest to comment routes to delete the comment.Custom post types supporting comments will gain this ability automatically.
-
Add endpoint for post revisions.
Post revisions are now available at
/posts/<id>/revisions, and are linked in themeta.links.version-historykey of post entities.Custom post types supporting revisions will gain this ability automatically.
(props @tlovett1, #193)
-
Respond to requests without depending on pretty permalink settings.
For sites without pretty permalinks enabled, the API is now available from
?json_route=/. Clients should check for this via the autodiscovery methods (Link header or RSD). -
Add register post type argument.
Post types can now indicate their availability via the API using the
show_in_jsonargument passed toregister_post_type. This value defaults to thepublicly_queryableargument (which itself defaults to thepublicargument).(props @iandunn, @rmccue, #145)
-
Remove basic authentication handler.
This breaks backwards compatibility for clients using Basic authentication. Clients are encouraged to switch to using OAuth authentication. The Basic Authentication plugin can be installed for backwards compatibility and local development, however should not be used in production.
-
Require nonces for cookie-based authentication.
This breaks backwards compatibility and requires any clients using cookie authentication to also send a nonce with the request. The built-in Javascript API automatically handles this.
-
Clean up deprecated methods/functions.
Functions and methods previously deprecated in 0.8/0.9 have now been removed. Future deprecations will take place in the same manner as WordPress core.
This breaks backwards compatibility, however these were marked as deprecated in previous releases.
(props @rmccue, #187)
-
Only expose meta on 'edit' context as a temporary workaround.
Privacy concerns around exposing meta to all users necessitate this change.
This breaks backwards compatibility as post meta data is no longer available to all users. Clients wishing to access this data should authenticate and use the
editcontext.(props @iandunn, @rmccue, #135)
-
Add
json_ensure_responsefunction to ensure either aWP_JSON_ResponseInterfaceor aWP_Errorobject is returned.When extending the API, the
json_ensure_responsefunction can be used to ensure that any raw data returned is wrapped with aWP_JSON_Responseobject. This allows usingget_status/get_dataeasily, howeverWP_Errormust still be checked viais_wp_error. -
Use version option to check on init if rewrite rules should be flushed.
Rewrite rules on multisite are now flushed via an init hook, rather than switching to each site on activation.
(props @rachelbaker, #149)
-
Fix typo in schema docs
(props @codebykat, #132)
-
Add check for valid JSON data before using to avoid parameter overwrite.
When passing data to an endpoint that accepts JSON data, the data will now be validated before passing to the endpoint.
(props @rachelbaker, @rmccue, #133)
-
Add authentication property to site index.
(props @rmccue, #131)
-
Move the test helper to a subdirectory.
The plugin will now no longer prompt for updates due to the helper.
(props @rmccue, #127)
-
Include post ID with
json_prepare_metafilter.(props @rmccue, #137)
-
Corrected parameter names in x-form examples in docs.
(props @rachelbaker, #134)
-
Pass
WP_JSON_Serverinstance tojson_serve_request. -
Don't use deprecated function in
WP_JSON_Posts::edit_post()(props @rachelbaker, #150)
-
Pass post ID to
json_insert_postaction during both insert and update.(props @cmmarslender, #148)
-
Add descriptions to taxonomy term data.
(props @pushred, #111)
-
Ensure we handle raw data passed to the API.
-
Remove unused
prepare_authormethod fromWP_JSON_Postsclass.(props @rachelbaker, #165)
-
Add multiple post type support to get_posts method.
-
Return
WP_ErrorinWP_JSON_Posts::get_commentfor invalid comments. -
Update getting started documentation.
(props @rmccue, #176)
-
Improve and clarify "array" input syntax documentation.
-
Update post routes documentation.
-
Add documentation for user endpoints.
(props @rachelbaker, @rmccue, #158)
-
Add permalink settings step to Quick Setup instructions.
(props @kadamwhite, #183)
-
Update taxonomy collection to return indexed array.
(props @mattheu, #184)
-
Remove placeholder endpoints.
-
Fix issues with embedded attachments.
Checks that the post supports attachment data before adding it, and ensures we don't embed entities many layers deep.
(props @rmccue, #194)
-
Change post parent preparation context to embed.
(props @rmccue, #195)
-
Change server meta links to reference the WP-API organization GitHub repo.
(props @rachelbaker, #208)
-
Fix plugin tests
(props @rmccue, #215)
-
Check for errors with invalid dates and remove duplicate date parsing methods.
-
Move from
wp-json.php/towp-json/This breaks backwards compatibility and requires any clients to now use
wp-json/, or preferably the new RSD/Link headers. -
Move filter registration out of CPT constructor. CPT subclasses now require you to call
$myobject->register_filters(), in order to move global state out of the constructor.This breaks backwards compatibility and requires any subclassing to now call
$myobject->register_filters() -
Introduce Response/ResponseInterface
Endpoints that need to set headers or response codes should now return a
WP_JSON_Responserather than using the server methods.WP_JSON_ResponseInterfacemay also be used for more flexible use of the response methods.Deprecation warning: Calling
WP_JSON_Server::header,WP_JSON_Server::link_headerandWP_JSON_Server::query_navigation_headersis now deprecated. This will be removed in 1.0.(props @rmccue, #33)
-
Change all semiCamelCase names to underscore_case.
Deprecation warning: Any calls to semiCamelCase methods require any subclassing to update method references. This will be removed in 1.0.
-
Add multisite compatibility. If the plugin is network activated, the plugin is now activated once-per-site, so
wp-json/is always site-local. -
Add RSD and Link headers for discovery
(props @rmccue, #40)
-
WP_JSON_Posts->prepare_author() now verifies the
$userobject is set. -
Added unit testing framework. Currently only a smaller number of tests, but we plan to increase this significantly as soon as possible.
-
Link collection filtering docs to URL formatting guide.
(props @kadamwhite, #74)
-
Remove hardcoded
/pagesreferences fromWP_JSON_Pages -
Fix compatibility with
DateTime::createFromFormaton PHP 5.2 -
Document that
WP_JSON_CustomPostType::__construct()requires a param of typeWP_JSON_ResponseHandler.(props @tlovett1, #88)
-
Add timezone parameter to WP_JSON_DateTime::createFromFormat()
-
Remove IXR references.
IXR_Erroris no longer accepted as a return value.This breaks backwards compatibility and requires anyone returning
IXR_Errorobjects to now returnWP_ErrororWP_JSON_ResponseInterfaceobjects. -
Fix bugs with attaching featured images to posts:
WP_JSON_Media::attachThumbnail()should do nothing if$updateis false without a post ID- The post ID must be fetched from the
$postarray.
(props @Webbgaraget, #55)
-
Don't declare
jsonSerializeon ResponseInterface(props @rmccue, #97)
-
Allow JSON post creation/update for
WP_JSON_CustomPostType -
Return null if post doesn't have an excerpt
(props @rachelbacker, #72)
-
Fix link to issue tracker in README
(props @rmccue, @tobych, #125)
-
Add compatibility layer for JsonSerializable. You can now return arbitrary objects from endpoints and use the
jsonSerialize()method to return the data to serialize instead of just using the properties of the object.(props @rmccue, #24)
-
Fix page parent links to use
/pages(props @thenbrent, #27)
-
Remove redundant
WP_JSON_Pages::type_archive_link()function(props @thenbrent, #29)
-
Removed unneeded executable bit on all files
(props @tierra, #31)
-
Don't include the
featured_imageproperty for post types that don't support thumbnails(props @phh, #43)
-
Use
wp_json_server_before_serveinstead ofplugins_loadedin the Extending documentation for plugins(props @phh, #43)
-
Parse the avatar URL from the
get_avatar()function in core, allowing custom avatar implementations -
Ensure that the author is set if passed
(props @kuchenundkakao, #44)
-
Clarify the usage of
WP_JSON_CustomPostTypein plugins(props @rmccue, #45)
-
Ensure JSON disabled error messages are translated
(props @rmccue, #38)
-
Remove extra "Link: " from link headers
-
Remove redundant
get_avatarmethod inWP_JSON_Posts(props @rachelbaker, #35)
-
Rename
WP_JSON_Server::get_avatar()toWP_JSON_Server::get_avatar_url()(props @rachelbaker, #35)
-
The response handler object is now passed into the endpoint objects via the constructor, allowing you to avoid excess global state where possible. It's recommended to use this where possible rather than the global object.
(props @rmccue, #2)
-
Fix undefined variables and indices (props @pippinsplugins, #5)
-
Correct call to deactivation hook (props @ericpedia, #9)
-
Check metadata access correctly rather than always hiding for users without the
edit_post_metacapability (props @kokarn, #10) -
Return all term metadata, rather than just the last one (props @afurculita, #13)
-
Access post metadata from cache where possible - Note, this is a backwards compatibility break, as the format of the metadata has changed. This may change again in the near future, so don't rely on it until 1.0. (props @afurculita, #14)
-
Add term_link to prepare_term (props @afurculita, #15)
-
Fix hardcoded
/pagesreferences inWP_JSON_CustomPostType(props @thenbrent, #26) -
Sanitize headers for newlines (props @kokarn, #7)
-
Register rewrite rules during plugin activation (props @pippinsplugins, #17)
- Huge documentation update - Guides on getting started and extending the API are now available for your perusal
- Add generic CPT class - Plugins are now encouraged to extend
WP_JSON_CustomPostTypeand get free hooking for common actions. This removes most of the boilerplate that you needed to write for new CPT-based routes and endpoints (#380) - Use defined filter priorities for endpoint registration - It's now easier to inject your own endpoints at a defined point
- Update the schema - Now includes documentation on the Media entity, plus more (#264)
- Add better taxonomy support - You can now query for taxonomies and terms
directly. The routes here might seem strange
(
/posts/types/post/taxonomies/categoryfor example), but the intention is to future-proof them as much as possible(#275) - Ensure the JSON URL is relative to the home URL (#375)
- Check all date formats for If-Unmodified-Since (#378)
- Register the correct URL for the JS library (#376)
- Correct the usage of meta links (#379)
- Add filters for post type and post status data (#380)
- Separate parent post and parent comment relation (#330()
-
Add support for media - This has been a long time coming, and it's finally at a point where I'm happy to push it out. Good luck. (#272)
-
Separate the post-related endpoints - Post-related endpoints are now located in the
WP_JSON_Postsclass. When implementing custom post type support, it's recommended to subclass this.The various types are now also only registered via hooks, rather than directly in the server class, which should make it easier to override them as well (#348)
-
Add page support - This is a good base if you're looking to create your own custom post type support (#271)
-
Switch from fields to context - Rather than passing in a list of fields that you want, you can now pass in a context (usually
vieworedit) (#328). -
Always send headers via the server handler - Endpoints are now completely separate from the request, so the server class can now be used for non-HTTP/JSON handlers if needed (#293)
-
Use better error codes for disabled features (#338)
-
Send
X-WP-TotalandX-WP-TotalPagesheaders for information on post/pagination counts (#266)
- Add Backbone-based models and collections - These are available to your code
by declaring a dependency on
wp-api(#270) - Check
json_routebefore using it (#336) - Conditionally load classes (#337)
- Add additional test helper plugin - Provides code coverage as needed to the API client tests. Currently unused. (#269)
- Move
json_url()andget_json_url()toplugin.php- This allows using both outside of the API itself (#343) getPost(0)now returns an error rather than the latest post (#344)
- Add initial comment endpoints to get comments for a post, and get a single comment (#320)
- Return a Post entity when updating a post, rather than wrapping it with useless text (#329)
- Allow filtering the output as well as input. You can now use the
json_dispatch_argsfilter for input as well as thejson_serve_requestfilter for output to serve up alternative formats (e.g. MsgPack, XML (if you're insane)) - Include a
profilelink in the index, to indicate the JSON Schema that the API conforms to. In the future, this will be versioned.
- Allow all public query vars to be passed to WP Query - Some private query vars
can also be passed in, and all can if the user has
edit_postspermissions (#311) - Pagination can now be handled by using the
pageargument without messing with WP Query syntax (#266) - The index now generates links for non-variable routes (#268)
- Editing a post now supports the
If-Unmodified-Sinceheader. Pass this in to avoid conflicting edits (#294) - Post types and post statuses now have endpoints to access their data (#268)
- Disable media handling to avoid fatal error (#298)
- No changes, process error
- Enable the code to be used via the plugin architecture (now uses rewrite rules if running in this mode)
- Design documents are now functionally complete for the current codebase (#264)
- Add basic writing support (#265)
- Filter fields by default - Unfiltered results are available via their
corresponding
*_rawkey, which is only available to users withedit_posts(#290) - Use correct timezones for manual offsets (GMT+10, e.g.) (#279)
- Allow permanently deleting posts (#292)
- Hyperlinks now available in most constructs under the 'meta' key. At the moment, the only thing under this key is 'links', but more will come eventually. (Try browsing with a browser tool like JSONView; you should be able to view all content just by clicking the links.)
- Accessing / now gives an index which briefly describes the API and gives links to more (also added the HIDDEN_ENDPOINT constant to hide from this).
- Post collections now contain a summary of the post, with the full post available via the single post call. (prepare_post() has fields split into post and post-extended)
- Post entities have dropped post_ prefixes, and custom_fields has changed to post_meta.
- Now supports JSONP callback via the _jsonp argument. This can be disabled separately to the API itself, as it's only needed for cross-origin requests.
- Internal: No longer extends the XMLRPC class. All relevant pieces have been copied over. Further work still needs to be done on this, but it's a start.
- Now accepts JSON bodies if an endpoint is marked with ACCEPT_JSON