I have a column in my terms
table called term_order
that was added by a plugin. I want to use this column as the sort order when querying terms via query loop.
This does not work:
return [
'taxonomy' => 'category',
'number' => 100,
'orderby' => 'term_order',
'order' => 'ASC',
'hide_empty' => true,
'exclude' => [1],
'parent' => get_queried_object_id(),
];
becauseā¦
Using
'orderby' => 'term_order'
directly within aget_terms
orWP_Term_Query
call in the manner youāve outlined presupposes that the term query system recognizesterm_order
as a valid ordering parameter. In standard WordPress installations, terms do not have an inherentterm_order
attribute in the database schema for direct ordering, unlike posts which have amenu_order
attribute.
Does anyone have a way to do this? To be clear, term_order
is not part of the termmeta
table, itās a column in the terms
table.