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
1answer
45 views

Get terms from posts submitted within a certain time

I am running a query which pulls out the most popular taxonomy terms (named "cause") from a custom post type (named "reasons") and I am ordering them by most popular. However, I need to limit the ...
1
vote
1answer
206 views

PHP Code to Display Term URL & Name of a Post Under a Custom Post Type

I am featuring a post in my footer(outside the loop) from a custom post type and am using Advanced Custom Fields plugin to do so. This is the code I am using: <h5>Featured Movie</h5> ...
1
vote
1answer
372 views

How to remove plugin-specific custom taxonomy terms when plugin is uninstalled?

I'm trying to write a class that would allow for easy removal of all plugin-related data when the plugin is uninstalled. Specifically, I want it to remove plugin options, custom post type entries, and ...
0
votes
1answer
23 views

Orderby taxonomy term id using get_posts not working

I'm looping through a series of custom post types and then grouping those by a taxonomy term. That is working great, however I have not been able to order these groupings by term_id. I used a ...
0
votes
1answer
19 views

Wrap custom terms loop

I have a custom terms loop, that gets category images and links. <?php foreach (get_terms( 'razotajs', 'orderby=count&order=DESC&hide_empty=0&parent=0' ) as $cat) : ?> <a ...
0
votes
1answer
28 views

How to get term by name with parent id?

So I have two menus which has childs with the same name. How to get term by name but from specified parent?
0
votes
1answer
98 views

get_term_by works but get_terms doesn't?

I currently have a Multisite with 2 sites. From the secondary site get_term_by() works to retrieve terms from the primary site, but get_terms() does not. I'm using switch_to_blog(1); but I get ...
0
votes
1answer
65 views

Get count for all terms inside a parent term

I am trying to get the post count for a term and it's child terms. I tried it with pad_count=> true but this seems to have no effect. My term stucture is like the following: - term 1: 10 posts - ...
0
votes
1answer
95 views

get_terms not working when child_of is used

I have a custom taxonomy registered as department, which works in other queries but it doesn't work when I use: $args = array( 'child_of' => 483 , 'hide_empty' => false); $subcats = get_terms( ...
0
votes
1answer
58 views

Hide Custom Taxonomy title if not associated with another Custom Taxomony

Custom Post type named Business (Custom Fields (Contact Details, Business Name)) Taxonomy for Type of Business (What they do (Cleaning, Auto)) Taxonomy for Location of Business; example Melbourne --> ...
0
votes
1answer
97 views

Display List of Categories Within a Custom Taxonomy

My website is an online magazine, so I have a custom function that creates a taxonomy (Volume/Issue) for Posts and Pages. Each issue of the magazine has its own particular category (e.g. News, ...
0
votes
1answer
84 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
40 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
78 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 ...
2
votes
0answers
260 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, ...
1
vote
0answers
207 views

Get those terms with a specific meta key value

I'm having a custom taxonomy for addresses. And I've created a true/false button through acf plugin to tell an address that it's the standard address. How can I get only the one term that has ...
1
vote
0answers
55 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 ...
1
vote
0answers
87 views

Custom taxonomy widget in admin area

I have a custom taxonomy set up on a custom post type and the box it uses is the same as categories, except I wanted to make it easily searchable using a filter script and then also allow the user to ...
1
vote
0answers
1k views

When using the get_terms and trying to order the terms using the 'order' and/or 'orderby' does not work

does this code really get you the categories in the order you want? $categories = get_terms( 'category', 'order=ASC' ); echo "<pre>"; var_dump($categories); for me, it does not. In fact, ...
0
votes
0answers
4 views

Paginate get_terms()

Trying to paginate taxonomy image terms. It uses the the get_terms() function but it does not work. Here is my code: $args = array( 'taxonomy' => 'issues', 'term_args' => array( ...
0
votes
0answers
9 views

make wp_get_terms show active links for custom post categories

I'm trying to figure out how to make a custom post category page (for a custom post) I want to have all the categories for the posts at the top of the page as links. I've used this code below to do ...
0
votes
0answers
24 views

wp_get_post_terms returns empty array

So I have a Post term called JobNumbers, which holds jobnumbers per page. I then enter into the DB a count per page/jobnumber. This has historically been working, but something happened and now it's ...
0
votes
0answers
31 views

How to get the terms list of current post's child taxonomy

This is my custom post type structure: Product (custom post type) productcategory (custom taxonomy) producttag (custom taxonomy) I want to get the terms list(all producttag) of current post's ...
0
votes
0answers
15 views

Fetching get_terms data of a custom [empty - no posts assigned] taxonomy its in archive page?

My problem: when I access an archive page of a custom taxonomy's subcat. or subsubcat. and the cat. has no posts assigned to it, WP get_terms() functions returns nothing. When a cat. has > 0 posts ...
0
votes
0answers
23 views

How do I output “Parent Term / Child Term” of a taxonomy for a custom post?

Inside a custom post (a glossary term), I want to output its subjects (in taxonomy 'glossary_subject'). Some subjects have parent terms. I would like my output to look like this: Parent Term1 - Child ...
0
votes
0answers
37 views

Get wp_taxonomy_term inside WP_Query throwing an error

I am using Elastic Grid in my site. When I am coding in to the WP it is giving me an error saying K.data(...).split is not a function Here is my code, $(function(){ ...
0
votes
0answers
20 views

ordering alphanumeric terms by numeric value

I have a list of terms under a custom taxonomy which all terms in there have combined alphabetic/numeric names (sheet 38 for example, which actually includes a a space as well). I want to order them ...
0
votes
0answers
14 views

Show “Parent Term / Term” in Edit Product Attributes tab - Multiple terms with same name

I have a WooCommerce site which needs to use the same term name in different parent terms under a given attribute. It has to be done this way because of the in-house infrastructure being that way. ...
0
votes
0answers
20 views

Ordering get_terms with ACF not displaying all terms

I'm making a shortcode to return all the terms in this taxonomy. The terms are sorted with krsort by the custom field 'height' made from ACF. I'm following this answer from here. The problem is it's ...
0
votes
0answers
13 views

query term by name with quote inside

I need to fetch a term by names that may contain single quote: $my_names = $_POST['my_names']; var_dump($my_names) // array(1) { [0] => string(14) "Chef d\'oeuvre" } //$my_names = ...
0
votes
0answers
41 views

get_the_terms is not working

After I updated WordPress, a function using get_the_terms() is not working. When I run get_the_terms() I'm not getting terms, but when I add before that call wp_cache_flush(); I'm getting terms so ...
0
votes
0answers
17 views

Getting Post Tags From Certain Categories

The site I am working on has about 4 different post categories. I need to output a list (unordered) of tags in that category so that a user can click on them and see posts in THAT category tagged with ...
0
votes
0answers
90 views

get_terms functions.php

my functions.php function retrieve_my_terms() { $get_participants_country1 = get_terms('participants_country', array( 'hide_empty' => false ) ); $teras_terms = array(); foreach( ...
0
votes
0answers
33 views

Show only Taxonomy Titles that have been selected in the Custom Post Type

I have the following code $post_type = 'dealer'; $tax = 'regions'; $tax_args = array( 'order' => 'DESC', 'parent' => 0, 'hide_empty' => 1, ); // get all the first level terms ...
0
votes
0answers
11 views

What is the earliest hook you can piggyback on to check terms/taxonomy for a collection view?

I am attempting to set up some conditional logic based on whether or not get_the_terms( $post->ID, 'product_cat' ) has the term 'Photographs' in it. Currently I'm using the wp hook, but that ...
0
votes
0answers
32 views

Get Meta Values and Count based on Meta Keys

Is there a function or a script to get the distinct meta values given a meta key and post type? I was hoping for a function similar to get_terms() for taxonomy. In addition to each meta value, there ...
0
votes
0answers
101 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
0answers
118 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 ...
0
votes
0answers
24 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
0answers
195 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 - ...
0
votes
0answers
78 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 ...
0
votes
0answers
55 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 ...
0
votes
0answers
130 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
0answers
104 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
0answers
94 views

How to filter the terms to a special custom taxonomy?

I do have a custom taxonomy called "countries". With the code below I get for each term (country) the number of its published posts in brackets, like the following: Canada (3) USA (5) Italy (2) ...
0
votes
0answers
239 views

Using get_terms() as shortcode attribute

Hop you pepople would be fine. I'm creating a shortcode with the following code. $categories = get_terms( 'project-type' ); foreach ($categories as $category) { ...
0
votes
0answers
382 views

Get only last child category link of products

At the moment i have this code: $collections = get_the_terms( $post->ID, 'product_cat' ); foreach( $collections as $collection ) { $link = get_bloginfo( 'url' ) . '/' . $collection->slug . ...
0
votes
0answers
347 views

Taxonomy archive link from term id

I'm using advanced custom fields taxonomy field to select a particular term of a custom taxonomy. I can generate the term ID based on the field but I can't display the link or the name of the term. ...
0
votes
0answers
1k views

How to get variation by order id on WooCommerce?

I am trying to get variation from wp_woocommerce_order_itemmeta by order id. My products have detail terms but I can't find them. It looks like this on wp_woocommerce_order_itemmeta: 431 52 ...
0
votes
0answers
350 views

Hide WooCommerce out of stock product attribute items

I've created an attribute for WooCommerce products: size, it has three items, size1, size2 and size3. I can use get_terms('pa_size', 'orderby=name&hide_empty=1'); to get size attribute items. ...