Questions tagged [custom-taxonomy]

Custom criteria that allow categorization, identification, nomenclature, and classification of various entities in software.

Custom defined criteria that allow categorization, identification, nomenclature, and classification of various entities in software and programming.

Custom taxonomies are commonly used in WordPress and Drupal as a methodology to group and organize content entries.

1187 questions
103
votes
9 answers

Get custom product attributes in Woocommerce

In Woocommerce, I am trying to get product custom attribute values but I fail miserably and I don't get anything. So I tried: global $woocommerce, $post, $product; $res =…
ShintoTuna
  • 3,677
  • 8
  • 29
  • 36
15
votes
3 answers

Have a WordPress page with same title as custom post type “front” slug

I have a custom post type djs and a custom taxonomy city with two terms: boston and nyc. So a DJ can either be tagged as Boston or NYC. DJ profiles (a single djs post) are located at /nyc-wedding-dj/joe-shmoe/, for example, or for a Boston DJ,…
HandiworkNYC.com
  • 10,914
  • 25
  • 92
  • 154
14
votes
4 answers

How to get the taxonomy values of a custom post type

I am creating a new template that will get all the custom post type (Case Studies) content, including the taxonomies values associated with it. So far I got the following:

user2091936
  • 546
  • 2
  • 7
  • 28
13
votes
1 answer

How To Exclude Results From Custom WordPress MySQL Query By Taxonomy Term

I only want to show posts which do not have the term 'brand-slug' for the taxonomy 'product-brand'. My current query doesn't apply the filter: SELECT DISTINCT * FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS meta ON p.ID = meta.post_id LEFT…
HWD
  • 1,547
  • 7
  • 36
  • 72
12
votes
4 answers

Custom Taxonomy not showing in Post Gutenberg editor

I have registered a custom taxonomy in Wordpress, and I can't work out why it is not displaying in standard Wordpress posts, since Gutenberg has been introduced. What I mean by this, is that it does not display in the document sidebar when adding or…
dungey_140
  • 2,602
  • 7
  • 34
  • 68
12
votes
2 answers

Create new product attribute programmatically in Woocommerce

How can I create attributes for WooCommerce from a plugin? I find only : wp_set_object_terms( $object_id, $terms, $taxonomy, $append); From this stack-question But this approach required id of some product. I need to generate some attributes not…
WebArtisan
  • 3,996
  • 10
  • 42
  • 62
10
votes
1 answer

Hook into 'save custom taxonomy' like 'save_post' in WordPress

Is it possible to hook a function when a custom taxonomy term (which is not known beforehand), (preferably custom taxonomy child term) is edited/saved, just like the way we can hook into save_post when a post or page is saved? What I want to do when…
andyderuyter
  • 1,081
  • 2
  • 8
  • 25
9
votes
2 answers

Get all product categories in WooCommerce

I am trying to get product categories in WooCommerce, but get_terms() function doesn't work for me. I am getting an empty array. What I am doing wrong? How to get all Woocommerce product category terms?
9
votes
5 answers

Remove add cart button in Woocommerce for a specific product category

I have an issue how to remove a cart from a category product. It works just fine if I apply it to a specific id or all in general, but I am unable to do it for a category. Below is my code I have done regarding it. Also, I am struggling to apply…
SamsungBravo
  • 101
  • 1
  • 1
  • 5
9
votes
2 answers

Get the id of a WooCommerce product category by its name or slug

I have a wp template that I would like to assign to some pages. The template would ie. display all WooCommerce products that have the same master category name as the pages name itself. By far I have tried using this code, but with no good…
aln447
  • 981
  • 2
  • 15
  • 44
9
votes
1 answer

Wordpress get_terms returns empty array for custom taxonomy

i have a bit problem with Wordpress Taxonomies... Below you can see initialization of my custom taxonomy named job_keywords. function register_job_keywords() { $labels = array( [... lables here ...] ); $args = array( …
Griva
  • 1,618
  • 20
  • 37
8
votes
2 answers

How to add custom taxonomy in custom post type permalink?

I have a custom taxonomy called campaign and a custom post type called asset. For assets, I want to have the following permalink structure: mysite.com//. I have achieved this by the following code, but now if I go to any…
sadmansh
  • 917
  • 2
  • 9
  • 21
8
votes
1 answer

Add Product Attributes with values to a product in Woocommerce

I am using this code to add custom attributes $attributes = array( array("name"=>"Size","options"=>array("S","L","XL","XXL"),"position"=>1,"visible"=>1,"variation"=>1), …
8
votes
7 answers

get_terms() orderby name is not working - wordpress

I'm using wordpress, want first-level taxonomy terms to be ordered by name but below code is not giving me desired result. Here is my code: $args = array( 'taxonomy' => 'tax-category', 'hide_empty' => 0, 'hierarchical' => 1, …
aiddev
  • 1,409
  • 2
  • 24
  • 56
8
votes
2 answers

Display current post custom taxonomy in WordPress

I've created custom taxonomies on WordPress and I want to display the current post taxonomies on the post in a list. I'm using the following code to display a custom taxonomy named "Job Discipline":
Bhanu Chawla
  • 1,138
  • 2
  • 13
  • 26
1
2 3
79 80