WordPress.org

Make WordPress Core

Opened 7 weeks ago

Closed 4 weeks ago

Last modified 4 weeks ago

#54267 closed enhancement (fixed)

Allow for custom REST API namespace while register taxonomies

Reported by: spacedmonkey Owned by: spacedmonkey
Milestone: 5.9 Priority: normal
Severity: normal Version: 4.7
Component: REST API Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:

Description

Follow up from #53656

When registering a custom taxonomy, allow developers to define a custom namespace for the REST API, similar to the way they are current register a custom rest_base.

Change History (6)

This ticket was mentioned in PR #1770 on WordPress/wordpress-develop by spacedmonkey.


6 weeks ago

  • Keywords has-patch added; needs-patch removed

#2 @spacedmonkey
6 weeks ago

  • Keywords has-unit-tests added; needs-unit-tests removed

This ticket was mentioned in Slack in #core-restapi by spacedmonkey. View the logs.


6 weeks ago

#4 @spacedmonkey
6 weeks ago

  • Owner set to spacedmonkey
  • Status changed from new to assigned

#5 @TimothyBlynJacobs
4 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 51964:

REST API: Support custom namespaces for taxonomies.

While a taxonomy 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_taxonomy_items function has been introduced and the rest_get_route_for_term function updated to facilitate getting the correct route for taxonomies.

For maximum compatibility sticking with the default wp/v2 namespace is recommended until the API functions see wider use.

Props spacedmonkey.
Fixes #54267.
See [51962].

Note: See TracTickets for help on using tickets.