Skip to main content

Timeline for Order get_terms() By Custom Field

Current License: CC BY-SA 3.0

16 events
when toggle format what by license comment
Jan 26, 2017 at 22:30 answer added HelpNeeder timeline score: 0
Jun 17, 2014 at 4:34 history tweeted twitter.com/#!/StackWordPress/status/478757566327955457
Oct 15, 2013 at 18:39 vote accept Howdy_McGee
Oct 8, 2013 at 19:04 comment added Howdy_McGee @its_me I know, I just didn't want to answer a question G. M. solved xD
Oct 8, 2013 at 19:03 answer added Howdy_McGee timeline score: 8
Oct 8, 2013 at 19:03 history edited Howdy_McGee CC BY-SA 3.0
deleted 1646 characters in body
Oct 8, 2013 at 18:42 comment added its_me @Howdy_McGee Please remove the solution from your question and post it as an answer (yes, you can answer your own questions).
Oct 8, 2013 at 18:37 history edited Howdy_McGee CC BY-SA 3.0
added 1646 characters in body
Oct 8, 2013 at 18:30 comment added Howdy_McGee No no, thank you for your help! I got it to work with get_categories - I was misspelling orderby: Solution is in my Question - again thank you for your help!!!
Oct 8, 2013 at 18:12 comment added gmazzap In codex for get_categories orderby term_group is cited with any advice, but in codex for get_terms is said "not fully implemented (avoid using)" so isn't only your problem... sorry for your time loose, I remember I've used it with no problems...
Oct 8, 2013 at 18:04 comment added Howdy_McGee @G.M. You're right, it is saved in the database, juts not showing up in searches as it's a column - my mistake. It's showing all the correct values there too. Displaying my terms are still going through alphabetically though: get_terms('protax', array('hide_empty' => 0, 'order_by' => 'term_group', 'order' => 'ASC')); with ASC, DESC, and when I remove order entirely. It is including term_group with each category though so I have access to it.
Oct 8, 2013 at 17:18 comment added gmazzap $wpdb->update($wpdb->terms, array('term_group' => $cat_meta['order']), array('term_id'=>$term_id)); you need a WHERE clause and $cat_meta['order'] not all the $cat_meta array
Oct 8, 2013 at 17:13 comment added Howdy_McGee Something along these lines, in my save function: $wpdb->update($prefix.'terms', array('term_group' => $cat_meta)); ?
Oct 8, 2013 at 17:00 comment added Howdy_McGee :/ I'm not sure I follow. When or where do I set term_group?
Oct 8, 2013 at 16:45 comment added gmazzap get_categories as an option to order by term_group. Term group is a field in wp_terms table that AFAIK is not used by WordPress. So you can use the extra field to set the term_group and then use 'orderby' => 'term_group' in $args array for get_categories.
Oct 8, 2013 at 16:29 history asked Howdy_McGee CC BY-SA 3.0