Articles of terms

Custom Taxonomy Archive BUG

I’m hoping that Its just my tired eyes missing something and a fresh pair of eyeballs might catch what I’m missing. I have a custom taxonomy with a slug of ‘residential_project_types’ that is assigned to a custom post type of residential_projects. I want to display all terms from the taxonomy, outputting the term name and […]

how to filter each tag item?

By default wordpress displays tags as: Tagged in: Tag1, Tag2, Tag3, …so on I want to print it as Tagged in: #Tag1, #Tag2, #Tag3, …so on I know I can do this using CSS by using :before, but I thought of doing this the PHP way. I searched the documentation and couldn’t figure out much, […]

How to list 2 taxonomy terms for a post, based on their hierarchy

I’m using get_the_terms to display 2 terms on a post, associated with the taxonomy “location”. The terms are the suburb and the city. The location taxonomy is hierarchical so the suburb is a child of the city. In the post edit screen a user selects their city, followed by their suburb (which lists the suburbs […]

List Terms in Category

I want to list all terms of a specific taxonomy used in a category. Like I have a taxonomy called ‘Manufacturer’ and a category ‘Shoes’. Each post in this category has a term like ‘Nike’, ‘Adidas’ or ‘Reebok’ and of course there are some posts having the same term. And on the archive page I […]

How to insert an array of terms using wp_insert_term?

WP provides a function to insert terms: <?php wp_insert_term( $term, $taxonomy, $args = array() ); ?> I have 60 $terms, each has its own $args, I want to prepare the 60 terms as an array, then, insert them at once. Is this posible? How?

Handling duplicates with wp_insert_term()

I’m using wp_insert_term which works quite well Now I want some error handler for when using the same name. $term_id = wp_insert_term( $term, ‘wpsc_product_category’, $args ); if($term_id) {//my operations here} where $term = $_POST[‘categoryTitle’]; I want to display some error when such name already exists. In wp_insert_term, how to check if this $term_id is duplicate? […]

Get main parent categories for a product

Can someone please help me, I’m looking for a way to find the main parent product category of a WooCommerce product? Say, the product is marked under Gadgets, but the main parent of them all is Electronics. I want this per post, as I want to add a class to each post signifying its main […]

Display post taxonomies tree

I was able to get all the items of a custom taxonomy for a post, like this: $args=array(‘orderby’=>’parent’,”fields” => “all”); $term_list = wp_get_post_terms($post->ID, ‘tvr_amenity’, $args); My problem is that i would like to show the tree (respecting the parents) So i would like to get them ordered by name and parent but i cant find […]

Check if term is in a taxonomy?

Is there a function that does something like: is_in_taxonomy($term, $taxonomy) Where it returns true if $taxonomy has that $term. ???? Thanks!

Creating a function that receives the taxonomy terms that have been changed in a custom post type

Ive been looking into actions and hooks etc… from wordpress, but cant seem to do a very simple thing. I just want to execute a function whenever a post is updated, and within the function I want the names of the terms that have been changed on that save. So maybe some sort of before […]