Skip to content

Ensure Gutenberg appropriately respects the add ability to control order of terms #6688

Closed

Description

Is your feature request related to a problem? Please describe.
Terms such as tags or non-hierarchical custom taxonomies are always retrieved with order count. The request that retrieves a post's terms for a custom taxonomy looks like this:
/wp-json/wp/v2/my_custom_taxonomy?per_page=100&orderby=count&order=asc&_fields=id,name&include=term_id_1,term_id_2,term_id_3 (where term_id_1 etc. are the current terms associated with the post).

It appears that there is no control over orderby= to set it to, for example, term_order. Furthermore, this appears to be not only a limitation with Gutenberg (can't change what to ask for) but also with WordPress's REST API (can't change what's available to show). If I set orderby=count to orderby=term_order in the above URL then I get this message:
orderby is not one of id, include, name, slug, include_slugs, term_group, description, count.

Describe the solution you'd like
I'd like the ability to show terms in other orders, and especially ones that are not yet supported by WordPress's REST API; this is especially important for term_order, because this is supposed to be the natural order of terms associated with an object, and this order is currently completely ignored.

To make things even better, it would be great to be able to control the order of the terms from the edit screen, or at least make it easy for a plugin to provide such controls.

Describe alternatives you've considered
I can control the order of the terms by filtering the get_the_terms hook to provide terms in the order I want them to be. While this works, it misappropriates the REST API by providing terms that should be in count order that are instead in the order I choose to supply terms in. We shouldn't need such hacks so early on in Gutenberg's career!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    [Feature] ExtensibilityThe ability to extend blocks or the editing experience[Priority] LowUsed to indicate that the issue at hand isn't a top priority to address and can be handled later[Type] EnhancementA suggestion for improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions