Questions tagged [get-terms]

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

I can get posts in all categories. But I want to get the custom post type I created

i created custom post type ('Ürünler') with some plugin. And I want to pull all posts from here with category titles. My code doesn't see the custom post type. I'll be happy if you can help me. $...
0
votes
0answers
25 views

Order by terms for specific custom taxonomies

I am using the following code to try and order property listings by state for For Sale and Sold custom taxonomy terms $terms = get_terms( 'state' ); // $terms = get_terms( array('status', 'state' ...
1
vote
1answer
20 views

How do I get a list of all categories that a given user has written blog posts for?

I need to retrieve the name of all the categories that a given user has published posts for. If I can also get a URL for the archive of that cat for that user only, this would make me very happy. How ...
0
votes
1answer
28 views

How do I return all terms from multiple taxonomies?

I need to generate a sorted array of all the terms within a set of (six) taxonomies (custom tags) for a custom post type without any duplicates (of which there are likely to be many). Is this ...
0
votes
1answer
12 views

How to use germ_terms() with meta_query for ACF Taxonomy field?

I have a custom taxonomy, Events (“event”). Through ACF, this also has a Taxonomy field, “Topic”, linking it to a secondary taxonomy, Topic (“topic”). I want to get_terms() for all Events terms ...
0
votes
2answers
23 views

Exclude posts from loop by term

Here is how the loop looks? I need to exclude a few posts with the custom term, how can I manage it <?php global $post, $PIXAD_Autos; $Settings = new PIXAD_Settings(); $settings = $...
0
votes
3answers
95 views

Show taxonomy list with taxonomy images ( SOLVED)

i have a taxonomy list in the home page made with https://wordpress.org/plugins/wp-categories-widget/ plugin .. i crated image field for taxonomies with ACF. i can show tax image on archive page but i ...
0
votes
1answer
15 views

how to show all categories by get_terms

I am using the below code but just display parent categories while i have many child categories. I want to display all categories including parents and childs <label for="<?php echo $this->...
0
votes
0answers
25 views

Wordpress taxonomy terms archive template help

I have custom post type Named Trips , Taxonomy > Destination , Region Activity Etc. Region Terms are , Annapurna , Everest etc. Activity Terms are trek, hiking, tours etc. I made an archive template ...
0
votes
0answers
30 views

Add list with categories to choose from and save it as the category for the post

I have a solution for the fact that users can now add categories to their posts. Problem: they don't know which already exist and which do. Therefore, I'd like to go to a route where users can choose (...
-1
votes
2answers
36 views

get_terms() - unexpected '=>' (T_DOUBLE_ARROW) error

I am trying to get the terms from all the taxonomies in an array. but this throws an error like this ..not sure why. Is it the wrong method?: Fatal error: syntax error, unexpected '=>' (...
0
votes
0answers
35 views

Restrict retrieved terms by category?

Is there a way to add a layer to the terms to be able to only retrieve the terms based on a category? I have terms attached to multiple different categories, but a lot less in individual categories. ...
0
votes
2answers
33 views

Filter “get_terms” query

I'm currently getting the data from a custom taxonomy using this: $terms = get_terms(array( 'taxonomy' => 'my_custom_taxonomy_name', 'hide_empty' => true )); Now, this returns a lot of ...
2
votes
1answer
98 views

Output the slug and name of a CPT single post taxonomy term

When I'm on a single post for a custom post type, I want to be able to grab the slug and name of the taxonomy term so I can insert them into a link. Below is what I've tried but it doesn't seem to ...
0
votes
1answer
30 views

Only return taxonomies that are linked to a category & product

What's the best way, to return taxonomies, but only taxonomies that are linked to a product, within the category, I have a heirachial taxonomy, I want to get all the top level options, once an option ...
0
votes
1answer
20 views

How to solve/debug get_terms suddenly showing no results?

Up until I just discovered, my taxonomy-company.php theme file was successfully generating an indented list of each "company" taxonomy term's corporate family tree. That is, company is a hierarchical ...
1
vote
1answer
56 views

Get terms ordered by post date

What I'm trying to achieve: get n terms from a custom taxonomy ordered by the newest post in each term. This will be used to display the newest m posts under each term. Is there a better way of doing ...
0
votes
2answers
25 views

Filter Custom Taxonomy Posts

I have a custom taxonomy page, it also has a slider up top. The problem is the slider displays random posts from all taxonomies rather than the current taxonomy. Is there a way to filter the images in ...
0
votes
1answer
28 views

Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)

I have created some custom taxonomies (using WordPress Pods) and they work great - but there's just one thing that I need them to do, and here's my question: How do I go about creating an archive ...
0
votes
1answer
33 views

Getting the post terms 'wp_get_post_terms' per post when within the functions.php file

I have used a form with an Ajax action to pull post information through on submit. It works a charm. However, I have used categories to separate the work into categories. One of which is the brand. ...
0
votes
2answers
41 views

Order get_terms by multiple values

Orderby of get_terms() does not accept array type. How do I make this code works? $allcities = get_terms( array( 'taxonomy' => 'city', 'hide_empty' => false, 'orderby' => array( '...
0
votes
1answer
20 views

Get All Taxonomy Terms From Get_terms Array With Specific Array Key

I have below code to extract all terms from multiple taxonomies, $taxonomies = array('ingredients','category','course'); $args = array( 'hide_empty' => 0 ...
0
votes
1answer
22 views

get parent and childs from hierarchcial taxonomy

I have a hierarchical taxonomy and I want to show only children from 1 parent. For example, the taxonomy looks like this: - Events -- Location -- Date - Region -- State -- StateCode When I use my ...
0
votes
1answer
141 views

I want to customize the_posts_navigation function by replacing prev and next with images

Hie, I am currently trying to customize the function 'the_posts_navigation' of Wordpress because I would like to let appear only "previous" and "next" (which I want to replace by icons of arrow in ...
0
votes
0answers
41 views

How to show hierarchical term tree from current term down?f

I have a taxonomy, company, wherein companies exist hierarchically. When I'm on the term page for a company, I want to show a list of all companies within its corporate tree, up and down... That is, ...
0
votes
1answer
32 views

Get all posts for custom taxonomy term

I have a custom taxonomy how-to-guide-type and I have some terms setup in this taxonomy. I want to display ONLY the posts assigned to each taxonomy term. I have the following but I can only seem to ...
0
votes
2answers
49 views

get_terms with posts that have a different taxonomy with term x

Here's the situation; I am using get_terms to retrieve all terms from Tax 1 with posts associated with it. Using the following $args = array( 'hide_empty' => 0, '...
0
votes
1answer
23 views

Display post after choice two taxonomy terms

I display post by a term filter (first taxonomy) and it works very well. I add an other list of terms filter (second taxonomy). I would like to display posts after choice a term in each taxonomy. ...
0
votes
1answer
45 views

get_terms only show term if there is a post using it

I have a custom post type called user_images. I would like to create some filters and populate the dropdowns dynamically. I am using the follow code: $post_type = 'user_images'; $taxonomies = ...
0
votes
1answer
146 views

$args for get_terms() to return ORDER BY FIELDS

I want to use get_terms() for a taxonomy in such as way as to emulate MySQL's ORDER BY FIELD e.g., ...FIELD ('aaa','ccc','bbb','eee','ddd') A var_dump snippet currently looks like: object(WP_Term)#...
0
votes
1answer
51 views

Is it possible to use array_walk() to append terms to an array of posts?

I'm creating a masonry post grid of animals. I plan to filter the the visible posts by toggling classes. The classes would in turn would be the post's. I'm using an MVC theme and would like to get ...
1
vote
0answers
79 views

How to order and count get_terms by specific post type?

I want to get a list of taxonomy "company" terms which have a particular meta value and which are associated with posts of custom type "viewpoint". Beginning with getting Viewpoint posts, as per ...
0
votes
2answers
249 views

Order get_terms() by hierarchy

I am trying to query a custom taxonomy terms in a way that keeps the hierarchical structure. Here is the code that I am using.. function ev_test_data() { $title = 'Mens Levi\'s Jeans'; $...
0
votes
0answers
18 views

how to display post of lowest terms - ancestors wise?

I want to achieve 3 post display from each taxonomy terms. But this terms will be passed from lowest of hierarchy in array that is ('munnar','cochin') etc. Europe Asia - India -- Kerala --- Munnar ---...
0
votes
0answers
27 views

Please: Display taxonomy child & parent

Newbie here! How would I modify this code to display the child (parent) ($show_count), like Station (Train Line)(#)? if( !empty( $train_station ) && ($hide_detail_prop_fields['train_stn']) != ...
0
votes
2answers
47 views

get_terms() but with additional dimensions?

How do I get all terms matching: custom taxonomy "company" only where term meta (ACF field) "tags" value matches a given string, "Publishing" only if the term has any posts of custom type "article" ...
0
votes
0answers
225 views

How to get_terms() only of terms matching an ACF meta value?

My custom taxonomy "company" has an Advanced Custom Fields field group with fields including a Checkbox, "tags". (This adds to each "company" term fields including "tags", which accepts multiple ...
1
vote
0answers
37 views

How to show all possible parents and children of a hierarchical taxonomy term?

I have a hierarchical custom taxonomy "company". Companies are hierarchical, they can have both owners and subsidiaries. So, some of my "company" terms have parents and children. Take this real ...
0
votes
2answers
148 views

Why is my custom taxonomy image not displaying?

I have created a custom image taxonomy field in WordPress using CMB2. I cannot get the images to display for website visitors even though my code uses get_term_meta. (The taxonomy images are amenity ...
1
vote
0answers
34 views

Get count of terms with a post and another taxonomy term?

How do I count the number of taxonomy terms which have both a) an associated post and b) where that post also has an associated term from another taxonomy? Specifically, I have... Custom post type "...
0
votes
0answers
20 views

How do I show a list of terms' posts, grouped by a secondary taxonomy?

Let's say I have custom post type article. I have a custom taxonomy fruit, with terms like apples. And another custom taxonomy company, with terms like juicy-inc and crunchy-co. Both are associated ...
0
votes
1answer
53 views

custom hierarchical taxonomy and custom post type list contains surplus posts

I wish to list custom taxonomy terms as titles and custom posts as lists under titles: Basics List item1 List item2 Movies List item3 Images List item4 However, custom taxonomy is HIERARCHICAL ...
0
votes
0answers
32 views

Why is the term of my current page not returning a slug?

Why is the term of my current page (custom taxonomy) not returning a slug? I have managed to get the following returned in my URL: 0, Array, '/{empty space}/ I am trying to pass the custom taxonomy ...
0
votes
2answers
64 views

How can I change the output display of my pagination?

How can I change the output display of my pagination? I have been trying for the past few hours to format the output of my pagination links (1,2,3, etc.) to resemble the below: I have been unable to ...
2
votes
2answers
57 views

Problems with function on function.php

I've a problem with some functions on function.php. I want to use get_tems_by("slug", $slug, "category"); but it doesn't work inside a function on function.php. When i changed slug by ID and give a ...
0
votes
1answer
69 views

echo a tax term in loop

I need to echo a term of a CPT in this loop after the for each item in the list. Any direction or help is appreciated. Original code is from Stackoverflow.com because it worked. <?php $da_place =...
1
vote
1answer
162 views

get_terms() order by term_meta

I'm doing a get_terms() query that I'm trying to order by a custom term meta. The custom term meta key is 'order' which as a numeric value (between 1 and 10). I have tried the following, but the order ...
0
votes
1answer
41 views

Count Number of Posts in Taxonomy Term in Last 24 Hours

if anyone could help it would be greatly appreciated, been trying to get this done on and off for a long time and just can't get there. I am using the function below in a loop to count posts within ...
1
vote
2answers
37 views

Term count by user

I am developing a section on the front of our website. Our users submit properties to our directory. we would like to show how many properties they have listed and what types. I have got this code but ...
0
votes
1answer
57 views

Matching slug terms from one array to those in array of WP_Term objects to output term names

I'm using WordPress's get_terms to return an array of WP_Term objects containing the term_id, name, slug, etc. for the child terms of a given taxonomy. I've saved this array to $tax_terms. I have a ...