Exporting-Importing A Category


When it comes to exporting, WordPress already does a wonderful job with it’s support to export posts, pages, comments, custom fields, categories, and tags. However, there is a problem. The WordPress exporter lacks granularity. What I mean by this is that, the exporter covers the entire blog instead of being able to select certain categories to export. I’ve searched the WordPress Plugin database high and low to look for a plugin that would specifically export categories and I could not find one. I did manage to come across two techniques though that get the job done.

There are two ways to export specific categories. The first is to read this forum post where HandySolo explains how to use the category RSS feed to export specific categories from a self hosted blog to a blog. The problem with this method is that, none of the meta data attached to the posts are carried over with the posts.

The second method is not pretty but it gets the job done. What I ended up doing was creating a new user account on my blog. I then used the post manager and filtered the posts by the category for which I wanted to export. I went through each individual post and quickly changed the post author from the original account, to the newly created user account. In my case, I had to do this to 25 individual posts. What is annoying about this method is that, when you save a post under a new author name, any blogs or posts that you have linked to within those posts will end up resending PINGs. However, I believe if you turn off this setting under the SETTINGS-DISCUSSION link in your administration panel this will prevent that from happening. Just remember to turn that back on after you’re finished.

After all of the posts within the category have been reassigned to a new author, you are ready to export. In your WordPress administration panel browse to MANAGE – EXPORT. Now here is the important step. Underneath where it says OPTIONS, you have a drop down box where you can restrict the export to a certain author.

WordPress Export Options

In the drop down box, select the newly created author and click on the DOWNLOAD EXPORT FILE and a WordPress WXR file will be downloaded to your desktop. This file will contain all of the posts from the category you wanted to export because the new user you created was assigned to only those posts within that category. This method actually allows you to export specific categories while maintaining the meta data associated with those posts such as comments and tags.

This is probably not the best way to obtain these results but it’s the only method that I’ve found that allows me to export specific posts/categories while still having all of the other data attached to those posts. If you have a better solution or know of a plugin that can obtain the same results, I’d be very interested to know about it.




  1. NewMexiKen (3 comments.) says:

    I agree, this would be a nice feature — to export by category. To export by date would be an even better feature. Indeed, it is nearly an essential feature if you have a large number of posts and the WXR file exceeds the limit on import file size.

    I have a somewhat related question. I find that the WXR file corrupts many characters — em dashes, latin letters, etc. Why is this? How can it be corrected? Anyone know?

  2. kim (6 comments.) says:

    thanks for that info…it helps me with one problem i’ve been trying to figure out…and WXR file exceeds the limit…

  3. Jenny (28 comments.) says:

    Awesome thanks. It’s exactly what I was looking for.

  4. Peter Murray (2 comments.) says:

    The real problem with the exporter, at least as I see it, is that an export-import process will renumber the IDs of the post and taxonomy records. There are a number of plugins out there that use IDs rather than slugs (as I found when I was updating earlier this year), and they break horribly when this happens.

  5. Mosh (4 comments.) says:

    The SQL to do this export wouldn’t be too difficult, especially with WordPress being nicely designed with only a small number of tables. If you’ve got access to the database directly with something like PHPMySQL then it’d be relatively simple to draft up a few queries (or one slightly more complex one) to drop the data out.

    I’m no expert (honestly, I’m not!), but I honestly think this is an easy task from that point of view. I know next to nothing about coding plug-ins however… There are far more complex works out there. If someone sees the need, I can see this being a relatively simple plug-in to write.

    The most difficult thing to keep on top of is the change in schema/structure of the WP database between versions, and any additional meta data added by other plug-ins. Still, this could be handled.

    Hmm. I forsee a project… :)

  6. Siddharth says:

    Nice find :)

  7. Jeff Chandler (295 comments.) says:

    @NewMexiKen I would love to see the exporter obtain many of those exporting options you described and I think it’s only a matter of time before those are added. As for the character corruption problem, I don’t know. I would look through the bug tracker for WordPress and see if thats been reported or look through the support forums. If you don’t see anything written about it, you might want to submit a bug report

    @Peter Murray Peter, you are spot on. When I reformatted my WordPress install and went the WXR route, it numbered all of my tags, comments, and post IDs, it was actually really annoying.

    @Mosh I’m no plugin or SQL magician myself which is why I came up with this mundane solution that end user’s shouldn’t have a problem executing. I don’t think creating a plugin for this type of functionality would be difficult at all, keeping up with the development of the core of WordPress would probably be the most difficult aspect of it.

    • Brad Hart (6 comments.) says:

      A matter of time still hasn’t come. We are a year and a half after you wrote this comment and more than 3 years since we started asking for this feature and they still haven’t listened. Everyone agrees it is an easily added feature, but alas no one on the development team seems to give a damn. WordPress keeps getting bloated with new and worthless features increasing the DB size and memory limit necessary to run it, yet we still can’t export by date or category, or even the more brilliant import/export between two blogs.

      It is time for Matt and the gang to remember this is wordpress, not windows…

      • Jeff Chandler (171 comments.) says:

        Well, you’re right, the exporter/importer still lacks the ability to perform even a simple export/import of a category. However, someone has heard my pleas and this year within the plugin competition, Ron created an advanced exporter/importer which I reviewed here.

        You can bet I gave this plugin a high score during the judging.

  8. SEO Web Designer Binh Nguyen (1 comments.) says:

    This remind me of the problem with WPMU Category. Not only that by default you can’t edit the category slug. But also when you want to modify the slug or name you will face troubles. So I wrote How to Change WPMU Category Name or Slug

  9. Mosh (4 comments.) says:

    I wish I had the time to sit down and try to figure out plug-ins. This would be a good one to start on as a project. if I ever get the chance, you’ll be the first to know!

  10. Charles (1 comments.) says:

    @Mosh:I think your method is direct, but I have a question. If you use sql to export the posts from database directly, how can you import this file(i don’t know what the db export exactly) to another weblog powered by WP?

  11. Mosh (4 comments.) says:

    @Charles: And another good point! The plug-in would have to be *import* as well as export. Dropping data from a database is simple enough, and you can dump it into a text file of whatever format (plain text, XML, whatever). But you’re right – whatever you use to import it back in must understand that format.

    Databases I do know, SQL I’m passingly familiar with, PHP is where I fall over and specific WordPress code… barely a beginner! But this *would* make a decent project, as I said. Worst case, you can use something scary like myPHPadmin to drop and reload the data but I’d recommend against in unless you really know what you’re doing :)

  12. Megapixels (12 comments.) says:

    An import SQL wouldn’t be that tough, once you have the export. I usually worry that I’m not getting (and sending) all the pieces. Once you’ve got that figured out, the SQL is trivial.

  13. Jeff Rothe (7 comments.) says:

    I also had looked high and low at one time to export a certain category of posts out of WordPress. I came across the HandySolo method, but the other method of changing the author is helpful albeit a pain.

    Seriously, it sounds like technically it could be difficult to make a plugin that would export / import individual categories, or integrate it into the core, but this is a feature that would see a ton of use.

    Maybe some brave sole will attempt it in your WordPress plugin contest running over the next two months. I have to belive a developer willing to make this as a plugin would have a good chance of winning if they did.

  14. Mosh (4 comments.) says:

    Honestly, I wish I had the time. I’ve never developed a plugin, but yes – this looks like an ideal task to work at. Sadly, I’ve got 3 weeks left on my contract, 20+ PCs to rebuild (very slow, old ones – one at a time), and 5 months’ of work to document for whoever takes over.

    After that I’m off travelling again. I almost wish I was sat somewhere I could work at this!

  15. Sordello (1 comments.) says:

    its easier you download rss file from a category (in category url add a /feed – ex:, save to your desktop and import from other wordpress installation. very easy. sorry for my bad english.

  16. Jeff Rothe (7 comments.) says:

    While is may be the ‘easiest’ solution available, that doesn’t mean it’s the best and I still think they should integrate this option into the core of WordPress, or if they think that this messes with their philosophy of the main package, I’ll like to hear the opposing argument.

  17. zes (7 comments.) says:

    Please help me anyone!

    I hope the commenters in this topic can give me some pointers since my problem is somehow related to the discussion.

    Here it is … I tried to export my blog to a local computer. But instead of downloading a .XML file it is downloading a .PHP file with 0kb. I am still using WP 2.8.5 and I am worried that I needed to upgrade to a newer version? Will that solve it or there is something wrong with my WP installation?


  1. […] & Exporting not just by author, but by category, or time range, or tag. Today there was a an interesting post by Jeff Chandler on the long way to export by category. However, a simple plugin would be awesome. […]

  2. […] på 100 poster var ikke tiltalende.  Etter å ha søkt litt på nett, fant jeg løsningen hos Weblog tools collection.  God bless […]

  3. […] that get the job done. This is taken from an article I wrote exactly one year ago, the irony!…ng-a-category/ WPTavern Twitter Account | Personal Blog | WordPress Weekly […]

  4. […] se altera en el proceso de importación (véanse, a este respecto, los comentarios al artículo Exporting-Importing A Category, del que me ocuparé más adelante). Esto no debería ser un problema (incluso puede ser ventajoso, […]

Obviously Powered by WordPress. © 2003-2013

page counter