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

Get the link of the first post of a custom taxonomy in a custom taxonomy list

Currently, I'm doing this using a custom field, but I would love for this to be automatic. Basically, I have a page that will list all the entries of a custom taxonomy, but I want the links of the ...
0
votes
0answers
16 views

If on parent term display child terms but on child terms display parent and siblings

I've been searching everywhere including the get_terms codex for a solution, but can't seem to get it right. I have a hierarchical taxonomy called "themes" with parent terms (e.g. "Acquisition of ...
1
vote
1answer
28 views

List child terms if parent but show nothing on children

I have a taxonomy called region with a hierarchical structure; • Southern Africa   • Botswana   • South Africa   • Zambia   • Zimbabwe In my taxonomy-...
0
votes
0answers
19 views

How to use foreach() for terms when there is no category assigned? [closed]

In my theme I am using a custom post type and the isotope for filtering the posts. I am using this code to get the custom categories: <?php while ( $the_query->have_posts() ) : $the_query->...
0
votes
1answer
32 views

How can I pull the slug of a custom taxonomy and output it in a class?

This is the file I'm working with: <?php $class =''; foreach ($consoles as $console) { $class .= $console->slug . ' '; } ?> <div id="<?php the_id(); ?>" class="<?php echo $...
0
votes
1answer
21 views

Limit Taxonomy Output in Conditional Statement

I am trying to limit the amount of category tags I output to 5 as well as append a "..." to the end of any items where the output was limited. I've got it mostly working except I can't figure out how ...
3
votes
1answer
5k views

get_terms - only top level

I am trying to get only top level term: $cat_args = array( 'parent ' => 0, 'number' => 10, 'hide_empty' => false, ); $categories = get_terms( '...
0
votes
1answer
427 views

“Trying to get property of non-object” error when using custom taxonomies

I am encountering a weird error when working with custom taxonomies. I am trying to get the name of categories of a custom taxonomy: $terms = get_terms('taxonomy_name'); foreach ($terms as $term) { ...
0
votes
1answer
20 views

Get all terms linked to a post and include those who not connected from get_terms and sort

I have the following terms in my WordPress project and my post may have connected with some of them or sometimes all terms. A B C D E F My first post (example1) is connected with terms A, B and C ...
0
votes
1answer
43 views

Can you hide empty terms using get_term_children?

I'm trying to get_term_children of a specific term: $style_categories = get_term_children( 29, 'product_cat' ); if ( $style_categories ) : foreach ( $style_categories as $style ) : $...
0
votes
1answer
25 views

Wordpress get all post with like in terms

I have a wordpress site, which has post and custom taxonomy. I want all post of a particular taxonomy with like query. For example: Table: wp_post post_id 100 Table: term_relationship post_id ...
3
votes
1answer
49 views

Order terms inside a select dropdown

I'm working on a project where I've a dropdown of all the terms inside a taxonomy. If the user selects a term, then a function is executed. Eveything is working great, but I can't get that dropdown ...
0
votes
0answers
15 views

Display posts in a custom taxonomy, grouped by a different taxonomy

The setup: I have a custom post type called products. I have a custom taxonomy called styles with terms modern, classic, rustic. I have another taxonomy called seasons with terms fall, winter, ...
0
votes
2answers
1k 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
1answer
995 views

get_term and get_term_by return null or false, even though term exists

I am trying to use the action hooks delete_term and 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 ...
0
votes
0answers
22 views

Wordpress using get_term to retreive slug not working as expected

Im using the below code to try and get the slug for the current category and the parent category. Ive managed to get as far as getting the currently cat slug but the parent displays in readable text ...
1
vote
2answers
664 views

How to limit the number of terms (terms acts like categories)

Hello i have created taxonomy in custom post type that act like category. then i have created terms that acts like categories. i have create widget that show all terms from taxonomy. all works great....
1
vote
1answer
33 views

How to get post's current parent term ID?

How do you get the ID of the parent term of the current child term assigned to a post. For a custom taxonomy? Custom taxonomy: "location" Countries Japan USA Mexico Cities New York Austin ...
3
votes
3answers
7k views

Get value in custom field with taxonomy [closed]

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
1answer
35 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 ...
-1
votes
1answer
1k 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' => ...
3
votes
1answer
77 views

get_terms showing link to category even if all posts are drafts

i have this code below to show links for my custom taxonomy on my custom posts. I want it to show only the categories that have published posts in them. This mostly works but if i put all the posts ...
0
votes
0answers
18 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
1answer
49 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
20 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
0answers
41 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 ...
1
vote
1answer
414 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
0answers
41 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
1answer
23 views

Get terms parent ID for conditional IF statement

I have the following working code to echo the name of the term (taxonomy called prodcats) that a series of posts are in. This is in the taxonomy archive template taxonomy-prodcats.php $terms = ...
0
votes
0answers
19 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 ...
2
votes
2answers
20k views

Woocommerce get cart total price in a number format [closed]

Is it possible to get the cart total price without any markup. So without the € symbol? Right now I'm getting the amount with: $totalamount = $woocommerce->cart->get_cart_total(); this ...
0
votes
1answer
113 views

Add arguments to get_the_terms for custom post types

When using get_the_terms to retrieve terms within a taxonomy for a custom post type you can't pass arguments, like so: function custom_cat_function() { global $post; $args = array( '...
3
votes
2answers
67 views

Child terms from multiple parents?

I'm using isotope to filter a custom post type. But I only want the child taxonomies of 2 particular parents. I have it working nicely for one parent, but I'm not sure how to modify the array to ...
5
votes
4answers
14k 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 ...
0
votes
0answers
28 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
41 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(){ $("#elastic_grid_demo")....
0
votes
0answers
22 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 ...
1
vote
1answer
185 views

How to get category image custom post type taxonomy in wordpress?

I have a custom post estate_property and its has taxonomies property_category ,propert_action.I have installed WPCustom Category Image to upload image for each category of taxonomies. How to display ...
0
votes
0answers
18 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
1answer
117 views

Sorting get_terms, ACF is automatically removing duplicates

I read over the ACF & WordPress documentation and both do not mention why/when/how duplicate values are removed from an array when sorting taxonomy terms by custom fields. I learned that ACF does ...
1
vote
1answer
135 views

Fetch and ACF image field from a custom taxonomy outside category/archive page? [closed]

I have a project where we have registered a custom taxonomy called "product-category" and have an Advanced Custom Field linked to it called "range_image". We then have a custom page template (not a ...
0
votes
1answer
29 views

Create a a form for custom taxonomy terms

Currently i am displaying a list of my custom taxonomy (contenttags). These are displayed in a list using the code below, which then displays the posts under that taxonomy. <?php $taxonomy = '...
0
votes
0answers
46 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
2answers
35 views

taxonomy terms are not populating select tag options

I am retrieving taxonomy terms. The code is working. Foreach creates three options for the select tag. There are three terms. But, when I wanted to echo "selected" for each options, after selecting ...
0
votes
2answers
751 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 ...
1
vote
6answers
5k 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 ...
1
vote
1answer
88 views

How to get custom posts sub category link

I'm trying to echo custom posts sub category link as a view more option.For the last week, i am trying to do that, but i just can't find the right way. I've tried, category links, terms, with args, id....
0
votes
1answer
34 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?
5
votes
7answers
24k 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' top-...
1
vote
2answers
130 views

Change link in get_terms if there is only one post in the category

I created a shortcode that will list the categories in my custom taxonomy and will return a list of all the categories that have at least 1 post (not empty). The result is that when someone clicks on ...