1

I'm trying to convert some tags in my website to categories, via either Wordpress import tools or Taxonomy Converter plugin.

In both cases, I get Internal server Error, when I try to query (load) the tags, because my website is having over 20,000 tags.

Is there a manual or MySQL query method I can use for converting? Since my website can't just display the 20,000 tags in a single page for me to choose from.

1 Answer 1

1

Yes, there is a SQL-based method to do this.

Just run this SQL (it will convert all tags to categories, if you want to convert only some of them, you have to add your conditions to WHERE clause):

UPDATE wp_term_taxonomy SET taxonomy='category' WHERE taxonomy='post_tag'

You can do this using $wpdb:

$wpdb->query( "UPDATE $wpdb->term_taxonomy SET taxonomy='category' WHERE taxonomy='post_tag'" );
2
  • Thanks! It worked. I had to get the term_id required from wp_terms table.
    – Ahmed Saad
    Commented Apr 19, 2014 at 7:22
  • Very interesting. I got here because I am looking to convert woocommerce categories into tags. Any idea? Commented Aug 28, 2015 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.