Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to export all Wordpress categories (no posts, just categories) from one blog to another. How can I do that ?

share|improve this question
    
Have you tried accessing Manage>Export from the blog's Admin panel. –  Omtara Nov 25 '11 at 17:40
    
There is no Manage menu, there is only Tools/Export menu but it doens't allow me to export categories only –  chubbyk Nov 25 '11 at 17:44
    
Sorry for that, I read that from a blog online. Could you do that from the database level? –  Omtara Nov 25 '11 at 17:59
add comment

migrated from stackoverflow.com Nov 25 '11 at 21:31

This question came from our site for professional and enthusiast programmers.

4 Answers

You cant export only categories (or taxonomies generally). Just export all content with Tools/Export and you can delete content except categories from xml.

share|improve this answer
add comment

What is your end goal here? Just to get a list of categories from one blog to another? Or, are you trying to move all of the content wihtin a category or categories to another WordPress install?

It kinda ugly, but you could export all content, then just delete the content within the categories or delete the categories that you don't want. It would probably be one of the quicker ways to your goal.

share|improve this answer
add comment

I solved this problem with 2 queries.

This is not the best way I suppose, but for sure not the safest. Furthermore it assumes that you are working on the same database (if this is not tha case you can easily export the query and then import into another db).

I've used it on an empty wordpress installation:

  1. Import the category's terms:

    INSERT INTO newwp_terms SELECT te.* FROM oldwp_terms te JOIN oldwp_term_taxonomy ta ON te.term_id = ta.term_id WHERE ta.taxonomy = 'category';

  2. Import categories relationships and descriptions

    INSERT INTO newwp_term_taxonomy SELECT term_taxonomy_id,term_id,taxonomy,description,parent,0 FROM oldwp_term_taxonomy ta WHERE ta.term_taxonomy_id IN ( SELECT ta2.term_taxonomy_id FROM oldwp_terms te JOIN oldwp_term_taxonomy ta2 ON te.term_id = ta2.term_id WHERE ta.taxonomy = 'category' );

I'm sorry I'm not able to indent properly the queries code, anyway newwp_ refers to table into which you want to import while oldwp_ refers to source table

share|improve this answer
add comment

If you have access to the database tables you can do a mysql dump export of the wp_term_relationships, wp_term_taxonomy, wp_terms tables and import those into the new wordpress installation. I just did this between two WP installs with over 300 categories and it worked fine.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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