[wp-trac] [WordPress Trac] #53656: Not possible to get a post type's REST API namespace if modified

WordPress Trac noreply at wordpress.org
Sun Oct 31 23:15:25 UTC 2021


#53656: Not possible to get a post type's REST API namespace if modified
--------------------------------------+---------------------------
 Reporter:  swissspidy                |       Owner:  spacedmonkey
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  5.9
Component:  REST API                  |     Version:  4.7
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:  rest-api
--------------------------------------+---------------------------
Changes (by TimothyBlynJacobs):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"51962" 51962]:
 {{{
 #!CommitTicketReference repository="" revision="51962"
 REST API: Support custom namespaces for custom post types.

 While a custom post type can define a custom route by using the
 `rest_base` argument, a namespace of `wp/v2` was assumed. This commit
 introduces support for a `rest_namespace` argument.

 A new `rest_get_route_for_post_type_items` function has been introduced
 and the `rest_get_route_for_post` function updated to facilitate getting
 the correct route for custom post types.

 While the WordPress Core Block Editor bootstrap code has been updated to
 use these API functions, for maximum compatibility sticking with the
 default `wp/v2` namespace is recommended until the API functions see wider
 use.

 Props spacedmonkey, swissspidy.
 Fixes #53656.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53656#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list