Skip to content

Instantly share code, notes, and snippets.

@lswilson
Created April 2, 2014 17:02
Show Gist options
  • Save lswilson/9938396 to your computer and use it in GitHub Desktop.
Save lswilson/9938396 to your computer and use it in GitHub Desktop.
WordPress: SQL Change multiple categories to a custom taxonomy
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