Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

In WordPress, terms are itens set to a taxonomy, i.e. when you create new categories or tags you create new terms.

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

Pass array of taxonomy terms to wp_query

I am trying to compile an array of taxonomies and terms to pass to wp_query, my array looks like this... Array ( [0] => Array ( [taxonomy] => color [field] =&...
0
votes
1answer
32 views

wp_split_shared_term_batch messing up upgraded ACF 5 data

After upgrading Wordpress and associated plugins to the latest version on a dev server and migrating the source files and database to the production server, the data from ACF is different. prod and ...
0
votes
0answers
26 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
0answers
20 views

WP REST API - Add post with taxonomy using term_name

Hi there we have API requests hitting our WP site to import posts into a custom post type. In the JSON for the post type the taxonomy "job_sector" is sent through as a string using the terms name ...
0
votes
2answers
39 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 ...
0
votes
2answers
21 views

taxonomy terms, inverted

I have a taxonomy that will be the brand, and the children’s items the template. I have a code in single.php to show the details. <div class="box2"> <div class="faixa"> ...
2
votes
2answers
39 views

Ordering terms before displaying posts

My question is close to other questions, but I dont' have enough reputation to comment. I'm working for a restaurant and I 'd like, for my menu page, to organise my posts "meal" under terms "...
0
votes
1answer
37 views

How to update incorrect post count in taxonomy?

I have imported a large amount of content using WPAllImport, all to a custom post type called "article" ("Articles") and all organised by a custom taxonomy type called "source" ("Sources"). However, ...
1
vote
1answer
50 views

How to check the terms in single custom post type template

I have custom post type called events it has event_type taxonomy with two terms namely past-events, upcoming-events. I want to check my single post's term whether it's under past-events or upcoming-...
1
vote
1answer
34 views

How to get data about category in category.php

I have to make custom category.php template, but how do I get data about category in category.php? I need these: Category name and id Category's parent name and id All category's items Let's say our ...
0
votes
1answer
32 views

How to return newly added terms when using wp_set_object_terms

I am using wp_set_object_terms to add terms (attributes) to our WooCommerce products: wp_set_object_terms($id, array($migrate_case), 'pa_case'); This gives us the advantage (instead of using ...
0
votes
1answer
25 views

Use get_the_terms to list subcategories of custom taxonomy

Currently I use the following code to output all categories within this custom taxonomy in a custom post type: <?php $args = array( 'post_type' => 'video_cpt', '...
0
votes
1answer
125 views

How to get all attributes with their terms related to specific Woocommerce product category [closed]

As we know, to get terms of specific attribute added to a product we can use: $attr_terms = $product->get_attribute( 'attr_slug' ); OR to get all terms of specific attribute regardless of a ...
1
vote
1answer
24 views

Create / Close Div in Array [closed]

Found several similar questions, couldn't get anything to work. Trying to setup a bootstrap card that is created from array data. I am using the code below to create the divs if the array has data. ...
0
votes
1answer
23 views

Exclude product attributes from taxonomy terms loop

As the title suggests, i want to exclude product attributes from the taxonomy terms loop, but each attribute is a unique taxonomy, so i don't know exactly how to exclude all of them programmatically. ...
0
votes
0answers
21 views

Allow user to only assign terms to a CPT he can't edit

This is my first question over here, i hope i'll be posting in the right place and in the right way. THE PROBLEM I would like to allow a user to assign -via quick edit- custom taxonomy terms to a ...
0
votes
0answers
13 views

How To Create Taxonomy Term When Creating The Taxonomy Through Custom Plugin

I am trying to add Taxonomy Term pragmatically when creating taxonomy. I tried adding the wp_insert_term( 'A00', // the term 'we_colors' ); to the tax_color_palletes but this is not ...
2
votes
1answer
153 views

When to / not to use wp_get_post_terms vs get_the_terms?

A user contributed a note in the codex saying the only difference is that get_the_terms use cached data, and I already know that wp_get_post_terms let you retrieve data by slug, but I still wonder ...
0
votes
1answer
65 views

WP_Query use for a filter with multiple Taxonomies and Terms

So, what I'm trying to do, is to make an ajax filter, this is the portion of the filter code that builds the $args based on the data that came from the filter form, and afterwards (not in this code) ...
2
votes
2answers
25 views

How to use a Term Meta Field as a link

I created a taxonomy called animal and a term meta field called horse. I created a function in my functios.php file to make it easier to display the data. Here is my code: function ...
0
votes
0answers
33 views

Filter ACF Repeater results by selected Taxonomy term?

Is it possible to filter the repeater by selected Taxonomy term? I have a repeater setup with multiple fields, one of which is a taxonomy field (ie: color). I'm needing to display only specific ...
1
vote
2answers
72 views

How to create a theme template for the taxonomy “root”

I just come up with this issue for a project that uses a lot of taxonomies and I need to list posts using the taxonomies itself, not only the terms. I have a taxonomy called "Colors", so the terms ...
0
votes
0answers
26 views

Exclude taxonomy term in archives, but make it readable on its own

Background: Making an event site that automatically hides expired events. Using WP-Cron and some tinkering, I've made it so my CPT "event" automaticly has an "Active" term in the taxonomy "Status", ...
0
votes
1answer
13 views

Update term_id to new value wherever it exists, to combine the two.

We have two categories in our database, and the second one was created mistakenly and misspelled. The first is spelled correctly (term_id 43), and the second is not (term_id 86). I want to combine the ...
0
votes
0answers
31 views

Conditionally remove a taxonomy from a post

I'm working on a custom post type with some custom fields. Some of these fields are taxonomy selectors, first i select a taxonomy called "type", deppending on the chosen type a second taxonomy ...
1
vote
0answers
51 views

Allow a Taxonomy Term to be Used Only Once Across All Posts

I have a Custom Post Type called Pricebooks. I then have a custom taxonomy for Pricebooks called Zip Codes. Within that taxonomy the terms are the actual zip codes. I want to limit a Zip Code (the tax ...
0
votes
0answers
9 views

Problem view pagination [duplicate]

I have problems ... I try to implement a pagination but it does not work: <?php $post_type = 'automotive'; $slug = 'ford'; /* ferrari, peugeot */ $taxonomies = get_object_taxonomies( ...
2
votes
0answers
40 views

Output the content of a term organised by each of the CPT?

I have four CPT and several shared Custom Taxonomies for all. I need to retrieve and output the content of a term (let's say "environmental-crisis" of the shared taxonomy "Crisis Type", and organise ...
1
vote
2answers
27 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 ...
1
vote
1answer
16 views

how to get the assigned child term of the term's parent

I've read multiple stacks on different ways of doing this, but I've yet to find something that solves my problem. I have a parent term "Web" and a child of that term "Web Development". The current ...
1
vote
1answer
81 views

WPML Translating a term/taxonomy programmatically

I have all terms in English and I am creating/duplicating the same ones for German language by using foreach on english terms and this way i create all terms for German language. The problem is when ...
1
vote
0answers
27 views

wpdb->term_taxonomy count posts from both published and private posts?

I'm trying to understand why this query won't include both private and published posts when counting and sorting the taxonomy terms. $taxonomyTypes = "AND ( tax.taxonomy = '" . ...
0
votes
1answer
89 views

How to display custom taxonomy term meta on custom post type

I am new to custom taxonomies, and created a taxonomy with 3 term meta fields using the generator on wp-hasty.com The taxonomy and new fields show up properly on the back end, and I am able to save ...
0
votes
1answer
52 views

Taxonomy term page going to 404

Why are my hits for a taxonomy term page getting a 404 error? I have taxonomy "source', registered in code through a plugin... <?php /** * Plugin Name: Context Taxonomy for Sources * ...
0
votes
0answers
47 views

wp_term_taxonomy count column is not saving to the requirement

As I'm trying to insert SubCategory into wp_term_taxonomy table. After executing the below lines of code $query_term_taxonomy = $wpdb->insert('wp_term_taxonomy', array( 'term_id' =>...
1
vote
1answer
33 views

Modify automatically generation of slug when term is created

I need modify the sanitize of slug when a term is created. For example I'm creating a term with name 0,5 and the slug automatically generated is 05. I need to add a dash in the position of the comma, ...
0
votes
0answers
25 views

Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies

I have 4 custom taxonomies that are associated with a custom post type "procedure": "vehicle_year", "make", "model", "axel_type". I've built a dropdown that is dynamically populated based on the ...
0
votes
1answer
20 views

Query for post term that matches user ID

I'm trying to set up something to decide wether the current post has a custom taxonomy term that matches the current users ID. So far I set up a variable that stores the taxonomy terms of the given ...
1
vote
0answers
17 views

Custom Status of Custom Post type need to EXCLUDE from Taxonomy pages

I have 400 custom post type posts saved as DRAFT which are no longer in use but it can be in future, So for SEO purpose i want now to have all those posts accessible with direct URL but not showing on ...
0
votes
1answer
146 views

How to change a Wordpress term's slug before saving

We are using WP All Import to import product data from a CSV into WooCommerce. Everything works fine (great plugin!) but we have one problem: Two of our product attributes contain disallowed symbols: ...
1
vote
0answers
54 views

Sort order by slug for looped child terms of custom taxonomy

I have page that displays multiple carousels that contains the posts for each child term of parent taxonomy: projects for the custom taxonomy: portfolio-categories for CPT: portfolios. When Portfolio ...
0
votes
1answer
22 views

outputting taxonomy hierarchy

I have a site where I've listed a list of subcategories for a side navigation. I need to break those subcategories into a more specific hierarchy. It's currently outputting a list from a parent ...
0
votes
1answer
77 views

Search Terms - Querying on either description__like OR name__like in the same Term Query?

In my theme's search.php I have a section set up to show terms that fit the search. I want the term to show up IF the $keyword appears in the term's title or its description. I have it set up to do ...
0
votes
1answer
40 views

taxonomy_edit_form_fields output after term fields

I'm using the following code to create a custom metabox on a custom taxonomy page. $term_filter_name_edit = $type . '_edit_form_fields'; add_action($term_filter_name_edit, 'box_term', 1000, 1 ); ...
0
votes
1answer
134 views

Custom Search | Wrong output & question

UPDATE: What I want to achieve is, that a user put's in XXX into the search text input and selects wether it is buy (meta_key=kauf, meta_value=1) or rent (meta_key=miete, meta_value=1) and then pushes ...
0
votes
0answers
14 views

Retrieve post based on previous random post

Two WP_Query to get post from two different Custom Taxonomies. Like This: <?php $args = array( 'posts_per_page' => 1, 'post_type' => 'ads', 'orderby' => 'rand' ); $the_query = ...
0
votes
0answers
26 views

Custom Post Type / Taxonomy / Term - what template to use to avoid 404-page?

I'm working on a site and am using Custom Post Types, Custom Taxonomies and Custom Terms for the first time. All goes well until I click a custom term. What I'd like to happen is get a page listing ...
0
votes
0answers
46 views

Custom value in term REST API

I try to add custom value (lang from polylang) to tags rest api. Finally i have what I want but I'm not happy for my code. I have: { "id": 290, "count": 0, "name": "112211", "slug": "...
0
votes
0answers
12 views

Get count terms only for certain posts type

I want to show a hierarchival menu for my taxonomies. I have 2 posts types : hotel landing_page Those 2 posts types share same taxonomies : hotel localisation France England ...