$args for get_terms() to return ORDER BY FIELDS
I want to use get_terms()
for a taxonomy in such as way as to emulate MySQL's ORDER BY FIELD
e.g., ...FIELD ('aaa','ccc','bbb','eee','ddd')
A var_dump
snippet currently looks like:
object(WP_Term)#1861 (10) { ...["slug"]= string(3) "eee"
object(WP_Term)#1862 (10) { ...["slug"]= string(3) "bbb"
object(WP_Term)#1863 (10) { ...["slug"]= string(3) "aaa"
object(WP_Term)#1864 (10) { ...["slug"]= string(3) "ccc"
object(WP_Term)#1865 (10) { ...["slug"]= string(3) "ddd"
Have been reading the codex but I'm missing something. Here's what I have:
$args = array(
'orderby' = 'include',
'order' = 'ASC',
'include' = array('aaa','ccc','bbb','eee','ddd'),
'fields' = 'all',
);
$roles = get_terms( 'role', $args );
As you can see above, the taxonomy
in wp_mc_term_taxonomy
is "role" and the slug
's are 'aaa','ccc','bbb','eee','ddd' in wp_terms
What is the secret sauce? Thanks!
Topic wp-parse-args terms Wordpress
Category Web