Created
April 2, 2014 17:02
-
-
Save lswilson/9938396 to your computer and use it in GitHub Desktop.
WordPress: SQL Change multiple categories to a custom taxonomy
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
UPDATE | |
wp_term_taxonomy tax | |
inner join wp_term_relationships rel on tax.term_taxonomy_id=rel.term_taxonomy_id | |
inner join wp_posts p on rel.object_id=p.id | |
inner join wp_terms term on tax.term_id=term.term_id | |
set tax.taxonomy='taxonomy-name' | |
WHERE | |
p.post_type = 'post' | |
AND | |
tax.taxonomy='category' | |
AND | |
term.slug IN ('category-one','category-two' 'category-three','category-four') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment