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

0
votes
3answers
1k views

Get only the first term by taxonomy

Maybe it's a stupid question but I can't find the answer. I have a custom taxonomy (directores) and each director is a term. Some times a film has more than one director. I need to print only the ...
0
votes
0answers
12 views

Taxonomy Term Variable within Foreach Loop

I have a foreach loop that cycles through all the terms of a specified taxonomy (product_cat in this case). I have the terms in a variable called $productTerm but I cannot get it work in one section ...
0
votes
1answer
16 views

Empty tax_query array returns an empty array

I would like to return all posts when the tax_query['terms'] is empty. $args = array( 'post_type' => 'product', 'posts_per_page' => 15, 'paged' => $paged, ...
0
votes
2answers
526 views

List all taxonomy terms / Show links if posts are attached, else names

I'm looking for a way to list all the terms from a custom taxonomy. Only the terms that have posts attached to it should have links to the archive page. If there are no posts attached it should only ...
0
votes
1answer
539 views

Issue on Listing Sub Product Categories In Woocommerce

Using Following code I am able to list all top level Categories on Woocommerce Product Categories $args = array( 'number' => $number, 'orderby' => 'title', 'order' => ...
0
votes
2answers
807 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 ...
0
votes
0answers
25 views

add_action priority and taxonomy used in plugin

I try to register my taxonomy in my plugin and use it after. So far I have done: function custom_taxonomy() { $labels = array( ... ); $args = array( ... ); ...
0
votes
2answers
641 views

Attempting to filter posts using get_terms

Using get_terms I've created three lists of term links. What currently happens if I click on a term is to see the archive for that term, what I'm attempting to achieve now is when I click a second ...
2
votes
2answers
15k views

Display current taxonomy term when inside custom post type

Well, this should be pretty simple, however I couldn't find answer anywhere on the web. all answers I found were close but no exactly what I needed. what I need is to display just the current term of ...
1
vote
2answers
51 views

Display latest x posts from all categories in Custom Post Type/Taxonomy

I am attempting to display the latest x posts from all categories using a custom taxonomy called 'case-studies' in WordPress. I have managed to output all the category names as heading links I have ...
1
vote
3answers
510 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 ...
0
votes
1answer
26 views

Getting Category Children

i have a problem understanding the get_terms function All i want is getting all the children of specific category so that it can be listed. But i don't really know how the $args works. So with this ...
0
votes
1answer
603 views

get_term and get_term_by returning null or false eventhough the term exists

I am trying to use the action hook delete_term, delete_$taxonomy, among other hooks that delete a term but they are presenting the same issue. For example: 1234 is an existing term in the favorite ...
2
votes
2answers
90 views

Display Category Thumbnail and links in Woo commerce

I would like to display my categories with a thumbnail in woocommerce. I am able to list the child terms as a link but i would like to add additional content. I have added the code below in which I ...
-1
votes
1answer
99 views

Display woocommerce product_cat child terms with thumbnails

I was wondering if someone could give me a hand. I would like to display the child categories of my woo commerce store categories along with the thumbnails I have set for them in my dashboard. I have ...
0
votes
0answers
41 views

Dropdown Settings API for get_terms Menu option

I am using get_terms to display a list of available menus and then display those menus for a plugin settings selection - that part works fine - but I can't retrieve and display the value. I am not ...
1
vote
1answer
255 views

Output terms to post_class()

I am trying to output all terms attached to a specific post (including custom taxonomy terms) as CSS classes applied to a DIV Something like that : <div <?php post_class('class-name'); ...
0
votes
0answers
16 views

Create a list of Taxonomy 1 terms for Post type in Taxonomy 2

I am trying to create a Select List of Taxonomy terms which are used in by a Post type in a different Taxonomy. I can't get my head around on how to do it. My post type is Game. Taxonomy 1 is Cities. ...
0
votes
1answer
36 views

Get all categories post is not in

I am trying to get a list of all categories that the current post is not in. I made it this far... $categories = get_the_category( $post_id ); $nocats = get_terms('category', array('exclude' => ...
0
votes
0answers
120 views

show/display/print list of sub-categories (of a specific parent category) assigned to products that have a specific other category

I have to find the products assigned to a specific category and after,just about those products, show the list of sub-categories of a specific parent-category here's a example scheme: product 1 - ...
1
vote
2answers
4k views

Get value in custom field with taxonomy

I have custom field my_cf for Taxonomy/Term. How can I get and output value with custom field for taxonomy/term? I've tried using: $variable = get_field('my_cf', 'basic'); echo $variable; ...
0
votes
3answers
2k views

Order get_terms using a Custom Field

I have a custom taxonomy of "crb_issues" that has a custom field associated with it that is "issue_date" which outputs a date value for each term to looks a lot like "20140601" yearmonthday. I am ...
0
votes
1answer
46 views

Get_terms stopped working after WP 4.2

I just noticed on my site that the custom taxonomy terms are no longer out putting. I am only guessing that it's happened since the 4.2 update. Here is the php: $terms = get_the_terms( $post->ID ...
0
votes
1answer
47 views

Get the selected term in a dropdown search

I am using the following function to create a dropdown search form and populate it with the terms of a custom taxonomy called 'grades'. The dropdown works for searching, but I can't figure out how to ...
0
votes
1answer
71 views

Add “selected” class to custom taxonomy dropdown search

I found the following function to add a custom taxonomy dropdown to a search form. It works fine for searching, but it does not add the "selected" class to the searched-for term. Here is my code for ...
0
votes
4answers
123 views

get_terms custom order

I am using the get_terms function to order all the terms of a custom taxonomy alphabetically. My client however has now requested that one of the terms be put at the very end (therefore not in ...
0
votes
0answers
17 views

How to order terms by parent term

I want to order the terms by parent. Parent term 1 -- Child term 2 -- Child term 3 -- Child term 4 Parent term 5 -- Child term 6 -- Child term 7 -- Child term 8 -- Child term 9 -- Child term ...
0
votes
1answer
27 views

get_term_link() returns correct - But illogical error-messages disturb

I've a really strange issue with Wordpress and the get_the_link()-function and a following issue with objects who are objects, but identified as non-object-error, itself they are working. First the ...
0
votes
1answer
15 views

Display empty custom taxonomies differently than with one with posts

I'm trying to display all of my custom taxonomies using get_terms. This part is fine. But I'd like to display the taxonomies that have zero posts attached to them slightly differently. Here's what I ...
0
votes
0answers
27 views

How to create a collection of terms used by posts from wp_query

I am creating a custom search results page that has a WP_Query that looks like this: $args = array( 'post_type' => 'manuals', 'posts_per_page' => -1, 's' => ...
0
votes
1answer
544 views

Add current class to queried term on taxonomy term archive

I'm currently using get_terms to list terms of a certain taxonomy. I would like to add a class to the term currently being queried via the archive template. I tried putting together the below code ...
1
vote
1answer
32 views

conditional statement based on terms

I was wondering if someone could help me out. I have created a custom query to retrieve in a custom single.php to retrieve posts which have the same custom taxonomy term and display them. here is the ...
0
votes
0answers
80 views

get_terms(); show private posts when logged in

Hi have a custom post type "FAQ". I got some "FAQ's" that are private, also only visible for logged in users. I used "get_terms()" funktion for a widget that is listing links to the categories of ...
0
votes
1answer
1k views

get_term_children for immediate children only (not grandchildren)

I want to display term children of a custom taxonomy. Currently, I am able to do this using get_term_children, but using this, it displays children and grandchildren, I want to avoid this and make ...
0
votes
2answers
2k views

get_term_link not working

I am trying to use the below code snippet to display an image and then wrap it in a link to a specific term archive page. In this case, I have a custom taxonomy (Series) with a few different terms. ...
-1
votes
1answer
101 views

How can I get parent term from a child term

I have a custom post type and a taxonomy, when adding a post if I select a child term and not the parent term then I cannot use get terms as the parent term wont be in the array as it wasn't selected ...
0
votes
1answer
20 views

CTP - check for value inside objects

I have registered a CTP which can add a new plant and user can tick which months it can be planted (february, march and april for example). Now, I need to display it on the page but with all months ...
1
vote
2answers
337 views

Get direct children of custom taxonomy

I've googled extensively and tried my best, but I just can't get the first level children of the custom taxonomy in the code below to work! It only displays the parent level. What I am trying to ...
2
votes
1answer
234 views

get_terms name__like list categories according to letter

My categories are basically authors, and I would like to create a function to list them according to their surname. For example I'd like to have something like: E: Heinz Erhardt Albert Einstein ...
0
votes
1answer
64 views

More efficient way to list posts by category [duplicate]

I have a page that lists posts grouped by category. Here is the current code: <?php $cats = get_terms('category'); foreach ($cats as $cat) { $cat_id= $cat->term_id; echo ...
0
votes
1answer
312 views

How to add a post counter to the list of custom taxonomy terms?

I am using the below code to display the list (radio buttons) of terms that are currently used by existing custom post type posts: $args = array( 'taxonomy' => 'typ', 'post_type' => ...
0
votes
1answer
89 views

Display Custom Taxonomy Terns ordered by meta_value

I got stuck with ordering custom taxonomy. I've created a hierarchical custom taxonomy called Brand and created some meta tags including one called position. Now I would like to display my terms ...
0
votes
3answers
112 views

Getting category URL with hyphens, not spaces

So, I am using this to get the URL: <a href="/category/<?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?>"> Which is outputting: ...
0
votes
1answer
31 views

How can I get 3 different taxonomy type terms in a div class element?

I have this situation where I need to filter specific post type posts by its taxonomies (there 3 different ones) and since I am using Isotope, I need them in my class element. I already made it work ...
0
votes
1answer
29 views

List terms and order by second word

I have the following code in my sidebar listing the terms or a custom taxonomy, these are names, first Name and last name. Is it possible to list them alphabetically by last name rather than the first ...
0
votes
1answer
139 views

Displaying a custom post types custom taxonomy value?

I've got a custom post type with multiple custom taxonomies + metaboxes. I've used multiple approaches from the codex and other on line resources but none seem to work. I basically want to display the ...
4
votes
5answers
16k 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
2answers
125 views

Custom Post Type archive loop separated by term, in specific term order

I have a custom post type registered (our-team) and I have a taxonomy (team-categories) with multiple terms. Each term has multiple posts assigned to it. On my custom post type archive ...
0
votes
0answers
56 views

Prevent repetitive terms in get_the_term_list

I've created a custom taxonomy 'work_category' for a custom post type 'works'. Then I added 5 new work categories and assigned them to every single 'work'. I've used get_the_term_list to print out a ...
4
votes
1answer
755 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, ...