Retrieve the terms in a taxonomy or list of taxonomies. Returns an array of term objects, or a WP_Error object if any of the taxonomies to get terms from does not exist.

learn more… | top users | synonyms

2
votes
4answers
8k views

Get the the top-level parent of a custom taxonomy term

How would I get the top-level parent of a given term? I am using wp_get_object_terms to get taxonomy terms on posts, but instead of showing all tagged terms, I only want to show tagged terms' ...
1
vote
1answer
195 views

get_post_terms not working as expected

I have a custom post type called "Fruit" and under this I have a hierarchical taxonomy called, "Fruit Categories" When I create a new post under Fruit, I am able to assign it to a "term" - like you ...
5
votes
2answers
795 views

get_terms vs. get_categories: does it matter?

I'm fairly new to wordpress and am coming across new things each day - one was today when I happened across get_terms and noticed that it was basically the same as get_category. Any particular ...
3
votes
2answers
910 views

get term by id without taxonomy

Can I get the term by it's id without knowing to whish taxonomy it belongs? I have a meta field that stores term ids, but doesn't store the taxonomy. However, all the get_term function have taxonomy ...
2
votes
1answer
4k views

How to only list the child terms of a taxonomy and not their parents?

I'm creating an age select menu in the admin, populated from a taxonomy of age. The taxonomy is hierarchical as follows: 18-25 (parent, ID 183) 18 (child) 19 20 21 22 23 24 25 26-30 (parent, ID ...
1
vote
2answers
391 views

get_terms orderby name as numbers

I have a custom taxonomy filled with terms such as 'volume 1', 'volume 2', 'issue 1', 'issue 2', 'issue 10' and get_terms orderby name returns list as: issue 1, issue 10, issue 2 though I need it to ...
0
votes
2answers
101 views

Term begins with a letter

I had a template that relied on $terms = get_terms( "ingredient", array( 'name__like' => $letter ) ); to return all posts where the custom taxonomy ingredient begins with $letter. The behaviour ...
0
votes
1answer
739 views

How to get the top most term (top ancestor) of a custom taxonomy child term?

I need to get the topmost term (top level ancestor) of a taxonomy term. Suppose the following term hierarchy: North America United States New York New York ...
0
votes
2answers
159 views

Echo used hierarchical taxonomies parent name

I want to echo my hierarchical taxonomies parents which I used in my posts. I've see answers about that, but no one didn't help me. To get all taxonomies, currently I use <?php the_terms( ...
0
votes
2answers
2k views

Get Current Custom Taxonomy ID by Post ID

If I know the current post id that i have in the variable $pid I use $terms = get_the_terms($pid, 'custom_category'); How do I get just the term id/term_taxonomy_id if I var_dump $terms I see what ...
0
votes
1answer
998 views

Using get_terms() to list terms from one custom taxonomy AND from one specific built-in category

I'm trying to get the terms of a taxonomy (kind) and the number of content they have but only for a specific category (get_parent_page_slug() = city name = category slug). This is what I have so far: ...