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

4
votes
1answer
180 views

Return only the custom sub-term for custom post type, do not echo term-parent

I've made a custom function that retrieves the custom taxonomy term for a list of posts in a query, and echos both the name and the link. Additionally, it also excludes listing a term if I specify the ...
0
votes
2answers
328 views

get_terms() for custom taxonomy related to another taxonomy

I have this weird thing to do and I have no idea how to do it. Ok, so: I have two custom taxonomies: collections and categories (both are prefixed, but for the sake of simplicity, I'll use these ...
0
votes
2answers
540 views

How to make a metabox that contains link categories?

I'm looking for some suggestions or tutorial links about how to create a meta box that allows users to choose from a list of link categories. So far I've been looking at this post about taxonomies in ...
1
vote
2answers
222 views

How to add terms to my tax_query based off of the current post

I need the terms in my tax_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get_terms() function. The problem is ...
0
votes
2answers
237 views

get_the_terms - but only show 4 Posts

I am using this code to load related posts with a custom taxonomy term slug: <?php global $post; $terms = get_the_terms( $post->ID , 'topics', 'string'); $do_not_duplicate[] = $post->ID; ...
0
votes
1answer
741 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
1answer
113 views

Unable to get the Parent Custom Taxonomy Terms

I am unable to get the Parent Taxonomy Terms here is the code i am writing $myterms = get_terms( 'iqvis_event_category', array( 'parent' => 0 ) ); echo '<pre>'; print_r($myterms); echo ...
0
votes
2answers
342 views

How can I get category ID by category name?

I have a few categories with the same name [some of them are sub-categories]. And I want to get an array of ID's for certain cattegory name. I tried this: $term = get_term_by('name', $cat_name, ...
1
vote
2answers
295 views

Show only the grandchildren (using get_terms)

I'm working with a hierarchical taxonomy (named "world") that has 3 levels to it (Regions > Countries > Indigenous Peoples). At the moment I'm using a modified version of this code to paginate ...
6
votes
2answers
2k views

get_terms by custom post type

I have two custom post types 'country' and 'city' and a shared taxonomy 'flag'. If I use: <?php $flags = get_terms('flag', 'orderby=name&hide_empty=0'); I get a list of all terms in the ...
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( ...
1
vote
1answer
236 views

Get posts inside Get terms problem

i have a get_terms which loads correctly. inside of it i have used get_posts. then using get posts i am trying to get each post tags (and count <= not currently inside this script) <?php ...
0
votes
1answer
240 views

term_exists returns NULL

According to the codex ( http://codex.wordpress.org/Function_Reference/term_exists ), term_exists returns some mixed results but not NULL. In my case, I'm getting NULL, what am I doing wrong? In ...
2
votes
1answer
167 views

Sort a custom post type array numerically

We've set up drop down lists to allow people to filter posts based on custom post types. In order to populate the drop down list I am using: <?php $terms = get_terms("ratios"); $count = ...
0
votes
1answer
202 views

Taxonomy order exception for specific term

I want to make an exception for my custom taxonomy order. Sometimes you need to put "Other" option as last option but when calling taxonomies with "orderby=name", sadly "Other" term is not listing as ...
3
votes
1answer
95 views

Is there any difference between post in child term and child & parent terms?

This may be really obvious, but I can't find other documentation or questions about it. Scenario I have a directory of Businesses (custom post types). Each Business has a "Type" (custom taxonomy). ...
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 ...
0
votes
1answer
203 views

Exclude main blog from get_blogs_of_user

I use WordPress Multisite and in the sidebar i have a box that shows a list of blogs the logged in user is a member of. I'm looking for a way to exclude the mainblog from this list. The main blog ID ...
0
votes
1answer
235 views

Get object terms with no children?

Others have asked how to only get parent terms, but I need to get the deepest term for the post of a specific taxonomy. Is there a way I can only get terms where the number of children = 0?
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 ...
2
votes
0answers
153 views

Display Terms for all posts in Current Archive or Query

I am using the following code to create a list of linked terms belonging to a taxonomy. <?php $taxonomy = 'taxonomy_name'; $queried_term = get_query_var($taxonomy); $terms = get_terms($taxonomy, ...
0
votes
2answers
79 views

How do I print a term list but alter the link text?

I have a long list of taxonomy terms that all look like City-ST-Zip, ie: Phoenix-AZ-85043 or San-Diego-CA-92037 How do I print the list of terms so that the link URL remains intact but the link text ...
1
vote
1answer
388 views

how does get_term_by know which term to return when the same term appears twice in a hierarchical taxonomy?

This is from the codex. <?php get_term_by( $field, $value, $taxonomy, $output, $filter ) ?> Suppose I have a taxonomy system as follows; taxonomy: "healthy foods" and it's a hierarchical ...
0
votes
1answer
387 views

How to check if a term is parent to another?

I have made a product page. Wich lists all products site.com/products. At the product page there is a navigation wich lists all the terms in the taxonomy 'kategori'. The taxonomy is set to ...
0
votes
1answer
193 views

Ordering taxonomy output in this function

I found (googled) this function which performs almost exactly as I need. Creating a link text structure (breadcrumb) of terms for a CPT i.e. Parent Category -> Child Category -> Grand Child Category ...
0
votes
2answers
3k views

get_terms of post->id

I need a way to use get_terms and have it only grab the taxonomies of the current page. Example http://sitename.com/genre/hip_hop would only grab the taxonomies that also have the hip hop genre ...
1
vote
1answer
350 views

get_terms - name__like a number

Using Get Terms with the argument of 'name__like', how do i return all results that start with any number? I've tried: $feats = get_terms( 'movies', array('name__like' => '1', 'name__like' => ...
1
vote
1answer
698 views

Custom taxonomy term as class?

I'm trying to add a class to a container within a query, ideally I'd like to use the terms from a custom taxonomy I have setup (guide-categories). As an example: <div class="myclass *taxonomy ...
2
votes
1answer
415 views

Control term order on a per-post basis

I have a taxonomy in which term order matters, but varies from post to post. So I want to be able to set the order that terms are displayed in on a per-post basis: My first post | Tagged: Apples, ...
0
votes
1answer
205 views

Is it possible to get_terms by author?

I get terms from all my posts with get_terms, $tags = get_terms( 'mytags', '&number=5&orderby=date&order=desc&hide_empty=1' ); foreach ( $tags as $tag ) { echo '<a ...
0
votes
1answer
2k views

Display Child Categories of Current Post ID

I'm starting to love this place more and more, super helpful! Anyway, todays dilemma is as such: I want to display as a list the child terms only, of a specific parent term, of a custom taxonomy, ...
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: ...
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' ...
0
votes
1answer
954 views

How to order a taxonomy's terms numerically, from lowest to highest using get_terms

I'm using get_terms to output a taxonomy's terms, which are all numbers: For example: 4, 6, 8, 10, 12 How can I order these numerically, so they appear exactly as above? What I'm getting is ...
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 ...
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 ...
3
votes
2answers
2k views

What is 'term_group' for 'order_by' in get_terms()?

I was just reading the Codex regarding get_terms();. What exactly is the parameter 'term_group'? You can use it in (example): 'order_by' for get_terms();. Hint: I could be all terms that share the ...
1
vote
2answers
453 views

get_terms problem : related articles

I'm trying to use get_the_term_list to catch the name of the current taxonomy of the page, and then use it with get_terms and a foreach method, to show the result of all the "elements" from the same ...
4
votes
1answer
564 views

get_terms() How many is TOO many?

Working on revamping a plugin of mine when I noticed that wp_count_terms() is not reflecting the same number as a call to count( get_terms() ) with the same $args passed. I'm pretty sure this is a bug ...