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
0answers
13 views

In WooCommerce, display category / subcategories for a given product [on hold]

I am using WooCommerce. For the current product, I need to display the categories that the product is in, and any subcategories, in this format: Main category / subcategory, subcategory ... Main ...
0
votes
1answer
18 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
47 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
0answers
8 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
4answers
64 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
1answer
12 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
14 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' => ...
-1
votes
0answers
11 views

How to retrieve metadata from a term in custom taxonomy

I'd like to get a meta value of a meta field from terms in a custom taxonomy. I started with retrieving all terms: $customTerms = get_terms('ss_category'); Each term from ss_category has multiple ...
1
vote
1answer
15 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 ...
-1
votes
1answer
37 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
19 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
100 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
86 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
50 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
52 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
58 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
20 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
25 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
68 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 ...
0
votes
0answers
43 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 ...
1
vote
1answer
46 views

Display a list of certain categories by ID

I have a list of custom taxonomy IDs like (1, 2, 3, 10). I want to display a list of these specified categories by names and each should have its childs like: Europe France Germany Africa ...
0
votes
0answers
20 views

Sort get_term_children when they are inside an array

At the moment I have this code below, but it doesn't sort the children. There are some answers on this website, but they involve a known category ID, while in this case the child categories are in an ...
1
vote
1answer
81 views

Display tags belonging to a specific post type only

The following code currently indexes all tags for my site (whether attached to a standard post or a custom post) like this I want to limit this code to index tags from only a specific custom post ...
0
votes
0answers
56 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
34 views

Query pages by child term

I cannot seem to get this to work, I have tried everything I can think of and spent enough time googling, to get me to seek help elsewhere. I need to query pages in a loop, using the same taxonomy as ...
0
votes
0answers
25 views

Getting two different answers when using get_the_terms

When setting a variable $cats = get_the_terms( $current_page_id, 'category' ); Outputting $cats to the console gives me two slightly different objects depending on the post. (Usually after a while ...
0
votes
2answers
347 views

get_terms: determine if taxonomy term has children

I'm looking to determine if a taxonomy term has children. See the below markup and I'll explain what I mean: <?php $terms = get_terms("wpsc_product_category"); if ( !empty( $terms ) && ...
0
votes
0answers
9 views

Use get_term to display top-level term only [duplicate]

I can't figure out how to modify this to display only the top-level term: $e_make_model_terms = get_the_terms( get_the_ID(), 'e_make_model' ); $make_value = ''; if ( ! empty( ...
0
votes
0answers
26 views

Generate list of tags from search results

On my search results pages I have my tags list too. But I only want to show tags that will filter the results further. So clicking on a tag will filter the result with the search term AND the selected ...
0
votes
2answers
350 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 ...
-1
votes
1answer
65 views

Can One Taxonomies Terms be Ordered by A Seperate Taxonomy?

I need some advice. I have a post type called "Movies" for example. Inside Movies, I have two taxonomies: Genres and Ratings Under Ratings my terms are 5 star, 4 star, 3 star, etc. Under Genres ...
0
votes
0answers
92 views

Issue on Counting CPT's Under Taxonomy Term

I am using this code to count number of Custom Post Type $tax_terms = get_terms($tax, $args); foreach ($tax_terms as $tax_term) { echo '<li>' . '<a href="' . ...
0
votes
1answer
47 views

Get Custom Taxonomy Terms by Date

I'm trying to get a list of custom taxonomy terms by date (or possibly slug). What I need is the NEWEST term and it's permalink in a custom taxonomy. I've been trying the code below but it's returning ...
2
votes
1answer
257 views

Get parent id by term id

I have the id of a term. Which is the function to call to get the parent id of the term?
0
votes
1answer
19 views

Getting the parent terms adds additional empty markup [closed]

I am trying to get only top level terms from hierarchical taxonomy called "City". It works fine in a way, because it outputs extra elements... $cities = get_terms( 'city' , array( ...
0
votes
0answers
31 views

Get Taxonomy Link if is in another Taxonomy

I am working on a site with a custom post type and two custom taxonomies: "book" and "chapter". I want to display a list of chapters of books. The Chapter list would link to posts tagged under that ...
0
votes
1answer
419 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' => ...
-1
votes
1answer
71 views

Issue On Listing Woocommerce Parent Tag List

I am having some issue on getting top level terms of product_cat Taxonomy of WooCommerce First of all I have a code which list all Terms in product_cat as: $terms = get_terms("product_cat"); if ( ...
0
votes
1answer
113 views

Display taxonomy term slugs

I'm looking to display a slug list of the taxonomy term for the current post within the loop. <?php $terms = get_the_terms( $post->ID, 'wpsc_product_category' ); if ( !empty( $terms ) ){ $term ...
0
votes
0answers
21 views

wordpress custom url rewrite for custom post type

I have a wordpress page https://example.com/service-detail/, it shows some result. Currently if i have to filter result, a parameter is passed like this /service-detail/?services=myservice ...
0
votes
0answers
124 views

How to get Taxonomies Only assigned to Queried Post types?

I'm developing a wordpress site about real state, I have a custom post type called "Property" and a custom taxonomy(attached to property post type) "Location" (Kendall, Boca raton , Del Ray beach ...
0
votes
1answer
141 views

get_terms from registered taxonomies not working

In functions.php I can var_dump() taxonomies like: $taxonomies=get_taxonomies('','names'); echo '<pre>'; var_dump($taxonomies); which give me: array(7) { ["category"]=> string(8) ...
0
votes
2answers
903 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
0answers
25 views

Custom taxonomy no data

Ladies and Gentleman, i have a problem. I habe created a taxonomy like this in my functions.php function drivers_init() { // create a new taxonomy register_taxonomy( 'tax_drivers', ...
0
votes
2answers
979 views

get_terms() doesn't return empty terms even though hide_empty is false

I can't manage to make get_terms() to return the empty terms and I've tried it in a number of ways. Here's the code: $terms = get_terms('device',array('hide_empty' => 0)); foreach($terms as ...
0
votes
0answers
63 views

Get Tags get_terms() - by user->ID ?

Is it possible to get tags for a specific user ID, i mean i want to get the tags list on author page where i want list the tags the author used to make his/her posts only - not want to get the full ...
0
votes
1answer
337 views

Listing child terms of parent term

I'm using the following code to generate a list of only the child terms within my taxonomy. What I'd also like to do is display a list of the child terms for each parent category on a ...
2
votes
1answer
67 views

Does WordPress Offer a Way to Find All of the Categories that Don't Have Children?

Background As discussed in Is There a Difference Between Taxonomies and Categories, taxonomies refer to a generalized system of classification and organization of objects or data. In the case of ...
0
votes
0answers
100 views

get_terms vs wp_query for pages - results inconsistent

I have a situation where a custom post type, with a related custom taxonomy. There are somewhere in the realm of 100 of these posts. The taxonomy associated to it has about 20 terms associated with ...