Last active
May 10, 2021 17:17
-
-
Save hamidrezayazdani/b4ea6c9856e2bf8113690445e9e586cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# For posts categories | |
SELECT t.term_id AS id, | |
t.name AS 'Term Title', | |
t.slug AS 'Slug' | |
FROM wp_terms t | |
LEFT JOIN wp_term_taxonomy tt | |
ON t.term_id = tt.term_id | |
WHERE tt.taxonomy = 'category' | |
ORDER BY name; | |
# For posts tags | |
SELECT t.term_id AS id, | |
t.name AS 'Term Title', | |
t.slug AS 'Slug' | |
FROM wp_terms t | |
LEFT JOIN wp_term_taxonomy tt | |
ON t.term_id = tt.term_id | |
WHERE tt.taxonomy = 'post_tag' | |
ORDER BY name; | |
# For WooCommerce product categories | |
SELECT t.term_id AS id, | |
t.name AS 'Term Title', | |
t.slug AS 'Slug' | |
FROM wp_terms t | |
LEFT JOIN wp_term_taxonomy tt | |
ON t.term_id = tt.term_id | |
WHERE tt.taxonomy = 'product_cat' | |
ORDER BY name; | |
# For WooCommerce product tags | |
SELECT t.term_id AS id, | |
t.name AS 'Term Title', | |
t.slug AS 'Slug' | |
FROM wp_terms t | |
LEFT JOIN wp_term_taxonomy tt | |
ON t.term_id = tt.term_id | |
WHERE tt.taxonomy = 'product_tag' | |
ORDER BY name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment