Questions tagged [taxonomy]

A taxonomy is a generic "category" used to organize posts and custom post types

Filter by
Sorted by
Tagged with
0
votes
0answers
12 views

Taxonomy terms are not checked when edit custom post

The taxonomy terms selected are saved but when I edit post the taxonomy terms are no checked again, Does anyone know why this happens?
0
votes
1answer
42 views

Display related CPT with custom taxonomy

I have two custom post types: "storefront_location" and "services" These are linked by a custom taxonomy "location" I am building a post template for "...
0
votes
0answers
72 views

WP Query should show No Posts when tax_query $args taxonomies don't have associated posts

I have a simple query. Getting the posts only if it have both the taxonomies in it. $args = array( 'post_type' => 'treatment', 'tax_query' => array( '...
0
votes
0answers
11 views

Show taxonomy term in multi dropdown select checkbox wordpress

<?php /** The taxonomy we want to parse */ $taxonomy = "nearby_amenity_taxonomy"; /** Get all taxonomy terms */ $terms = get_terms($taxonomy, array( "orderby" => &...
1
vote
1answer
12 views

Set post terms on post publish

I am trying to set post terms on the post, when it is puublished I use following code but is doesn't work add_action('pending_to_publish', 'oj_publish_post'); function oj_publish_post($post_id) { $...
0
votes
0answers
9 views

Taxonomy search

I've added custom taxonomy to my posts, and I was wondering if there's a way to create a search function where certain custom tanxonomies are displayed as a drop down, and then people can click on as ...
0
votes
0answers
40 views

mysql query for category and tag intersection

I am trying to build a query for a wordpress function to show categories for products, only if those categories contain products with a specific tag; so the shortcode should be something like: [...
1
vote
0answers
19 views

Hook for taxonomies needed

I am a newbie and spent now hours to no avail on this, so I really hope you can help me out here. One thing ahead: I do NOT want a plugin for this. I need to just change the word 'Cusine' (...
0
votes
2answers
31 views

Only show tag with the same id as the post

I have been stuck on the following case for a while now. On a page I have a list of tags which I try to filter. When the post for example has an ID of 10586, the only tag displayed should be 10586. ...
0
votes
1answer
10 views

Query all post and CPT from 2 specific taxonomies AND by ACF custom field

I need to build a complex query. I want to display all posts, and 2 different CPT posts in specific taxonomies. All of these posts need to have been checked to be displayed. The checkbox is added with ...
0
votes
0answers
7 views

Retrieve post from child category [closed]

I have a custom post and it is coded based on previous developer. Since the post/content I want is similar to previous custom post layout. I copied and paste all the necessary code and change to my ...
1
vote
1answer
39 views

Get term by slug in Gutenberg

In Gutenberg, one can use the getEntityRecord selector to get the data of a term of a specific taxonomy by its term id: // Get the category term with term id = 25 const term = useSelect( ( select ) =&...
0
votes
0answers
15 views

“Invalid taxonomy” with WP_Query's tax_query [duplicate]

In WP_Query using tax_query to get products in categories, I recieve "invalid taxonomy" error. Doing that in my child theme. It seems as if WordPress hasn't loaded taxonomies yet in the ...
0
votes
0answers
16 views

Is it possible to prevent the deletion of taxonomy by detecting $_GET request

Hooks are good and all, but I want to prevent the deletion of taxonomy by detecting $_GET requests if(isset( $_REQUEST['action'] ) && isset($_REQUEST['taxonomy'])) { if($_REQUEST['action'] ...
0
votes
0answers
15 views

WordPress 5.4 and higher: Filter posts by category 1 AND category 2 in API requests

We have a WordPress 5.4 instance that we query through it's API. I am hoping to find a solution for the following problem that works with newer versions as well. What I need is an intersection when ...
0
votes
1answer
24 views

Show recent posts from a custom taxonomy in wordpress

I create a custom taxonomy called "site". I cannot figure out what code to put in single.PHP to show related posts ONLY from "site" custom taxonomy. Please help.
1
vote
0answers
28 views

archive by year and category: permalink support doesn't work on pagination

I found here: Category archive by year with permalink support /category/YYYY the solution to obtain a category-by-year archive also supporting perma: function catyeararchives_init() { ...
0
votes
0answers
32 views

Wordpress Taxonmy Category Links 404

I was wondering whether I could get some help? I have created a custom post type and registered a taxonomy. Please see code below. However when I visit my taxonomy links, they either 404, or redirect ...
0
votes
1answer
22 views

Unique IDs for Post Types and Taxonomies

Sometimes I have duplicate IDs between Post Types and Taxonomies, I know this happens because they are stored in different tables but I wish it was possible to have a unique ID for each thing in WP, ...
0
votes
1answer
23 views

Get taxonomy singular name instead of taxonomy slug inside $taxonomy query

I'm trying to echo the taxonomy name inside a for each loop, instead of the category slug at this line : <div class="title"><?php echo $taxonomy; ?></div> I tried : <...
0
votes
0answers
20 views

If Term Name Exists, Append a Unique ID to Slug

How would I go about adding a unique ID to a custom taxonomies slug? We have multiple users who can create their own taxonomies. The problem occurs when two users wish to create a taxonomy of the same ...
1
vote
0answers
22 views

Taxonomy name repeating when showing 2 posts from each category

I am trying to get my page to show a custom taxonomy and then a the first 2 posts in that taxonomy, My taxonomy is called types post type is called guides I want the page so it shows like this Type 1 ...
0
votes
0answers
42 views

How to show only first, second, third Custom taxonomy conditionally

I have created a custom taxonomy names "colleges". Here I have added A, B, C, D etc custom taxonomy. And I want to show this taxonomy in single.php. <?php $args = array('number' =&...
0
votes
0answers
43 views

Rewrite Search URL Permalink For CPT Custom Taxonomies

My site uses a CPT with custom taxonomies and shows this URL for searches : https://example.com/?s=&post_type=listing&location=bridgeport&sale_type=for-sale&property_type=office But ...
0
votes
1answer
27 views

Auto-set a term's language upon creation (polylang)

I want to do a specific task each time a given term is created. My first approach was to do this via the addition of the following code into the main plugin file: add_action( 'created_term', ...
1
vote
0answers
6 views

Display Featured Post by Categories and Avoid duplicated posts

I'm learning Wordpress development on Udemy and currently developing a theme. I haven't added any custom taxonomy but just using the "Post" and "Categories". Found a tutorial of ...
0
votes
1answer
51 views

wp_set_object_terms creates taxonomies but does not add custom posts to it

I am trying to call wp_set_object_terms in a function hooked to custom post creation (via wp_insert_post_data) to set taxonomies tags for the post from a custom field: $item_brand = ( ! empty( $_POST[ ...
1
vote
0answers
22 views

Why does the argument list_only do on Walker_Category_Checklist::start_el?

On the post edit screen there is the meta box for categories that utilizes the Walker_Category_Checklist class to create the category checklist within the meta box. One of the conditions (line 90 of /...
0
votes
1answer
54 views

How to modify the output of wp_terms_checklist when used within the built-in category metabox on edit posts?

On the Edit Screen in the WP Admin there is a meta box for WP's built-in Category taxonomy. This meta box is built using post_categories_meta_box() (/wp-admin/includes/meta-boxes.php). This meta box ...
0
votes
0answers
14 views

Get taxonomy name by tax-query in posts list

I have ajax category filtering and I use it to get taxonomy id and list posts by taxonomy. Now I want to show current taxonomy name in list view. I have trying to add <h4>get_cat_name((int)$...
1
vote
1answer
21 views

Fetch taxonomies by custom post type id array

I want to find all the taxonomies that match an array of CPT id's. I have a taxonomy called location and I want to find all the locations where they have posts that are equal to my array of post id's ...
0
votes
0answers
9 views

Related Video Post by Custom Taxonomy “ Actor”

This my Related Video Post Template by categories. wp_get_post_categories( $post->ID ), 'numberposts' => xbox_get_field_value( 'wpst-options', 'related-videos-...
1
vote
1answer
19 views

Add meta noindex to post if it has a specific taxonomy

How can I add the following line to the current post if the product_type = 'enviso_group_ticket'? <meta name=”robots” content=”noindex,nofollow”/> product_type is a default taxonomy of the ...
1
vote
1answer
14 views

How to show CPTs in term archive

I attached default taxonomy "category" to a "story" custom post type, when I register it: 'show_in_rest' => true, 'show_in_feed' => true, 'taxonomies' => ['...
0
votes
0answers
12 views

Count for Media Library Attachments specified by Categories

I've added this function into my function.php file that allows me to specify images in my media library with categories. /* Add Categories for Media Library Attachments /*------------------------------...
0
votes
0answers
10 views

Menu items not found on category or tag page

I have the following menu call in the header.php file <nav id="site-navigation" class="navigation main-navigation" role="navigation"> <?php wp_nav_menu( ...
0
votes
0answers
20 views

Dropdown custom taxonomy with parent and child

i am trying to autofill all the parent field in a dropdown menu by selecting child (i know usually is the opposite, basically i have nested location with this structure: country state city area state ...
0
votes
0answers
16 views

Get ACF Taxonomy select values to update based on previous field selection

I have three Taxonomy fields on my page ('Sector', 'Subsector' and 'Key Role'). The Taxonomy itself is called 'Job Category', and 'Subsector' and 'Key Role' are both children of 'Sector'. So for ...
0
votes
0answers
26 views

What is the best approach to rebuild product category tree completely?

I have a pretty large hierarchical list of product categories (almost 300) which I need to rebuild from scratch. Once the category tree is completed, I need to re-assign all existing products (more ...
0
votes
0answers
12 views

Url leading to archive page, no matter what

A client passed me a website I do not know how to fix: a specific url leads to an archive.php page, no matter what. Say the url is 'classes', I created a page with /classes/ as url, but I get always ...
0
votes
0answers
37 views

tax_query not working on custom post type

For some reason my tax_query is returning 0 posts. I'm able to assign posts to the Tax and the archive pages work correctly. When I try to create the below custom query the post_count in the ...
0
votes
1answer
11 views

How to show taxonomy on front page

I have set template taxonomy-event_type.php which displays just right on http://localhost:8000/types/<type_name>/. What I need now is to: either redirect when user lands on http://localhost:...
0
votes
1answer
15 views

Save queried result into database

in multi author website when author publish post , he/her can give star rating to his/her own post. and I can display average rating for every taxonomy term using this formula: AVERAGE RATING=TOTAL ...
2
votes
1answer
57 views

Get the term for an taxonomy archive when the term has no posts

Seems like it should be simple (the Stack Overflow catchphrase) A taxonomy archive taxonomy-my-taxonomy.php, I'm using $terms = get_the_terms($post->ID, 'my-taxonomy'); to get the properties of ...
0
votes
0answers
22 views

Why doesn't 'post__not_in' work with 'cat'?

When I write 'cat' => '45', then post__not_in does not work, if you remove cat, then everything works without problems. I would be grateful for your help $args = array( 'posts_per_page' =>...
1
vote
2answers
38 views

Formulate a url to show posts with both taxonomy terms

I would like to show an archive of posts that have two taxonomy terms in common. So for example, I'd like to show all posts that have both the terms "sauce" and "cheese" in the ...
0
votes
1answer
23 views

Get Posts by Category, Tag , and CPT Taxonomy

How to print only those posts which have Category, Tag, CPT Taxonomy. I have tried out with this code but nothing prints. To print posts I used SS [commonposts category="2" tag="3" ...
0
votes
0answers
12 views

Change post status based on taxonomy

Need help with this code. I want to change status of a post if a taxonomy is Y value. The code I have, based on other I saw for meta fields. //add_action('init','my_hourly_event'); function ...
1
vote
1answer
329 views

Custom query to filter posts that have current post as a taxonomy [closed]

Introduction I'm a graphic designer that knows nothing about PHP, but I need to get my hands dirty in this particular situation and I need help from the coding gods. I've been struggling with this ...
1
vote
0answers
25 views

Searching in wordpress using wp_term_taxonomy table

I have been trying for some time now to return search results not only of products from woocommerce but also for anything that is found on the rest of my site. If you search for SKU "4110-26"...

1
2 3 4 5
38