WordPress.org

Make WordPress Core

Opened 3 weeks ago

#44505 new enhancement

term_order is an invalid orderby parameter in WP_Term_Query::get_terms()

Reported by: swinggraphics Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Taxonomy Keywords:
Focuses: Cc:

Description

This is a follow-up to #35381.

I'm wondering why term_order is not allowed as the orderby parameter in WP_Term_Query::get_terms() for functions like get_terms(). It is specifically invalidated on line 388. Granted, term_order isn't used for much in core right now, but the column is there, and one generally expects any column heading to be a valid orderby parameter. The workaround is to create custom meta for the terms and add a meta_query. There are examples on StackExchange/Overflow of people looking for a remedy. In fact, there is an example of this on trac ticket:34996, where the example used for justifying the addition of meta_query only exists because term_order is a rejected orderby.

I'm marking this as an "enhancement" because the code does what is intended, but unless one delves into the source code, it feels like a bug.

Change History (0)

Note: See TracTickets for help on using tickets.