'SQL query to search Custom taxonomy In wordpress
I was trying develop a custom search box and I want to search custom post type taxonomy and I found this SQL query useful but there is one small problem, This query search all the available taxonomy on the database you can see my picture:
I search for green color from product category (woocommerce) but there is no such category created at my site this is coming from attribute taxonomy
SELECT DISTINCT wp_terms.term_id,wp_terms.name
FROM wp_terms
inner JOIN wp_term_taxonomy
WHERE wp_term_taxonomy.taxonomy='product_cat'
AND wp_terms.name like "green%";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|