Created
March 22, 2018 13:54
-
-
Save twopix/fce56710f65695627c55a3656987c2d5 to your computer and use it in GitHub Desktop.
woocommerce get products with categories
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT p.id, p.post_title, p.post_name, p.guid, t.* | |
FROM wp_terms AS t | |
INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id | |
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id | |
INNER JOIN `wp_posts` AS p ON p.ID = tr.object_id | |
WHERE tt.taxonomy IN ('product_cat') and p.post_status = 'publish' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment