Batch Categories 0.9 [en]

Batch Categories for WordPress has been fixed and enhanced. If you have major category jobs to do, it can probably help you. Feedback and testers welcome.

[fr] Batch Categories pour WordPress a été corrigé et fonctionne à  présent. Le compagnon idéal si vous desirez changer les catégories de nombreux billets en même temps.

Batch Categories 0.9 is out! It’s the ideal companion for large-scale post-import messy category work. List all posts belonging to a category or matching a keyword, and edit their categories, easily visible at a glace with a collection of sexy drop-down lists. What’s new since the the first draft?

  • It now works, and does not “eat” categories without a warning. (Pretty nice of it, huh?)
  • It tells you what it did — which categories it added to which posts, and which ones it removed.
  • Add a whole bunch of posts to a category with one click.
  • Remove a whole bunch of posts from a category with one click.
  • Ensures that all the categories for a post are always listed, whatever the setting for the limit number of drop-down lists.
  • This is what it can look like.

You can still access it as a plugin or edit the Edit navigation menu, as described in my post introducing Batch Categories. If you’re in a hurry, just drop the PHP file into your wp-admin directory and send your browser straight on it.

Next steps?

  • Gather feedback from courageous testers (please don’t blame me if you haven’t backed up your post2cat table and things go wrong) for chasing the last bugs, improving interface and functionality.
  • Redo the code which generates the drop-down lists to take advantage of the category cache, and avoid flooding the database with useless queries.
  • Allow more subtle selection of posts: combinations of categories (AND/OR/NOT), categories without their subcategories…
  • Anything else you would want…?

Update 24.07.04: BB made me notice that “All” and “None” didn’t make much sense in the drop-down which allows one to select the categories to display. Replaced them in v. 0.91 by “Any category”.

124 thoughts on “Batch Categories 0.9 [en]

  1. I can’t get it to show more posts. I change the “$showposts=10;” to “$showposts=200;” and “$showposts=99;”, but I still don’t get any more posts. I’m trying to remove all posts on my WP blog from their parent categories and leave them in just their subcategories.

  2. Try using the select box to choose a category — that will show you all the posts in that category. Then you can use the “Add category” drop-down to put them in the parent category, and then the “Remove category” (same drop-down) to remove them from their old child category.

    Does this help?

  3. I got it working. Thank you. Actually, I regret having got it working, because in unassigning posts to their parent categories it took them off of the category dropdown on my index.php page. I ended up causing myself a problem, rather than a solution. Anyway, it works.

  4. Stumbled across your site from google, really would like easy category editing – but I can’t get it to work! 🙁 — I’m getting Parse error: parse error, unexpected T_VARIABLE in /../wordpress/wp-admin/batch-categories.php on line 24
    . I’ve tried on my home server and my internet server but it’s exactly the same on both! any ideas?


    – pj

  5. make sure there is no whitespace before the opening ?php tag and the closing ? one, first of all.

  6. I just used this great plugin to recat 827 posts.

    Reset all posts to default.
    Asked plugin to display the default (this was a mistake on my part asking it to do so much work), and then recat’d the posts in several huge chunks.
    No crashes, no oddness, worked wonderfully – great stuff !

    Thank you !

  7. Ah..
    Just got it tweaked nicely into my admin panel. Thank you. This Brings me one step closer to my migration from Blogger to WP.

    Nick // SC

  8. I think I may have found a bug in Batch Categories. Although, being careful, I think I can avoid it in the future…

    I was cleaning up some categories I had duplicated. I just finished batch changing all the posts. I went into the Categories screen, went to the sub-category to be removed. The categories I was working on looked something like this:
    – Spamming
    – – Referral
    – – Comment

    All three categories had posts that I moved to a different category that better fit. I had just finished removing the ‘Spamming’ category from posts that had them when I went to delete the Spamming category.

    When I deleted the ‘Spamming’ category, the admin pages died. The site was still OK, but I got errors when trying to access WP’s Admin pages. It was reporting a php error saying something about the fact that some headers were attempting to be loaded when index.php had already loaded them or something like that. It mentioned batch-access.php, so I deleted that file from the plugins folder and tried reloading the admin pages.

    I was able to reload the pages at that point. Whew! I uploaded the batch-access.php file and re-activated the plugin. Everything still works.

    The two sub-categories that were under ‘Spamming’ were now sub-categories of ‘WWW’. So I deleted them without incident.

    I am assuming that by attempting to delete a sub-category that had sub-categories of its own was not a good thing.

    I’m still going to use this plugin often, I just know I’ll need to move things around again. I’ll just stay away from deleting the category I had just batch moved if it has sub-categories of it’s own. 🙂

    Just thought you might want to know in case you can reproduce it.

  9. Trying to install this from WP Plugin Manager brings up a file called “batch-categories.tar.tar” which doesn’t unzip to anything. Can you make sure you include a zip as well as a tar since that works for just about everyone?

  10. I’m working with v1.5 and I’ve been trying for days to get this to work and it won’t even be recognized by the plugin admin screen. It’s there, there are no spaces where they shouldn’t be, but I can’t get it to work. It worked perfectly in 1.2.

  11. Lorelle: first thing you need to know is that Batch Categories is not a “real” plugin. The plugin file (batch-access.php) was provided as a convenient way to offer a link to the extra admin screen I provide (batch-categories.php). If I were to recode this now (and it’s somewhere on the to-do list), I would indeed integrate it more with the existing admin interface.

    The file you really want is batch-categories.php (don’t worry about the other one). Just drop it in your wp-admin directory, then point your browser to it (something like

    I’m not sure if it’ll work in 1.5 — I haven’t tried. Be really careful to back up your database if you do so, and let me know the result!

    Hope this helps.

  12. Thanks for the specifics. The other batch-categories plugin I used embedded itself right into the EDIT/MANAGE window of the WordPress Admin. This had me a little confused.

    It works like a charm with 1.5 with no trauma, so far….

    I’ll make a link from the manage window, but it would be nice it you could make it like a plugin so it would automatically make a link appear. Wonderful!

  13. Hi, great plugin, I am having a very small problem:

    When I try to use the “num=N” variable in the URL, it doesn’t work. Also the “Update” button doesn’t work. Any pointers?

  14. I figured out the first problem (num=N), it was browser related. The second problem the “Update” button, still doesn’t work. Any pointers?

  15. Unfortunately, this does not work with WP1.5. It conflicts with the admin.php script, lines 6-9. I hope you’re able to resolve the problems, because this looks like a great and much needed utility.

  16. I’ve been using this for a long time and LOVE it. Unforunately, I can’t get it to work in 1.5 either. Will keep trying, though.

  17. FYI, Post Levels v0.1 and Batch Categories 0.91 are not compatible when both installed and activated in WordPress v1.5 (final). I installed, activated and tested Post Levels first, and everything was fine. I installed Batch Categories next, and upon activation I got several PHP errors at the top of the Manage Plugins page itself, as well as every other page (have removed full path info from errors):

    Warning: Cannot modify header information – headers already sent by (output started at /home/.[…]/wp-content/plugins/batch-access.php:11) in /home/.[…]/wp-admin/admin.php on line 6

    Warning: Cannot modify header information – headers already sent by (output started at /home/.[…]/wp-content/plugins/batch-access.php:11) in /home/.[…]/wp-admin/admin.php on line 7

    Warning: Cannot modify header information – headers already sent by (output started at /home/.[…]/wp-content/plugins/batch-access.php:11) in /home/.[…]/wp-admin/admin.php on line 8

    Warning: Cannot modify header information – headers already sent by (output started at /home/.[…]/wp-content/plugins/batch-access.php:11) in /home/.[…]/wp-admin/admin.php on line 9

    Errors stopped as soon as I deactivated Batch Categories and refreshed the page.

    Would be extremely nice if you and the Post Levels author could collaborate on a fix so both plugins will co-exist on one WP installation. Thanks!

  18. Actually, the “batch-access” part of Batch Categories is not necessary and just makes access to the page easier (batch categories is not actually a plugin, in a sense that it does not use any API hooks; it’s just a standalone page which allows you to mess with the database).

    You can try accessing batch-categories.php directly by typing the address of the file in your browser. I am really not sure if it will work or not with 1.5 — so if you do try it, please:

    a) back up your database
    b) let me know how it went

    I will be converting Batch Categories into a real 1.5 plugin at some point, but I just have too much other stuff to deal with now.

  19. As I’ve told you, and will again and again, I adore this wonderful plugin. I just installed the new “final” Strayhorn v1.5 and now batch-categories won’t work for nothing. I’ve played around with bits and pieces but all I get is a blank screen. No error messages to help me narrow anything down.

    With everyone switching to 1.5 now (well, billions of folks at least – hee hee), this is too valuable a tool to let slide off the map. I think it should be part of the WordPress package – what a contribution!

    I really need this to work. It was working up until the new CVS….not happy.

  20. I’m really sorry to hear the plugin doesn’t work with 1.5.

    As I might have mentioned, I’m swamped right now. If nobody does it before me, I’ll adapt it to 1.5 at some point. If anybody feels like doing it, just go ahead! I really don’t care if it’s me or somebody else who writes the 1.5 version of Batch Categories.

  21. To fix the blank page issue in 1.5, at the top of batch-categories.php, right above the require line for admin-header.php, add another for admin.php, like so:


    That should be all you need.


  22. I see my system has sent a pingback I still wanted to say thanks for a great little utility. I have documented what it took for me to get Batch-Categories to work for me in WP 1.5

    Only thing I could hope for now is to figure out how to call the routine with just one post
    ie: wp-admin/batchcategories.php?post=134
    That would make it perfect – since I could easily update categories without the ‘post_modified’ date changing.

  23. Stephanie, when you get around to updating Batch Categories let me know, as I have a reconfigured version that works as a plugin. Still has the separate script (which needs some 1.5 remodeling), but your batch-access now incorporates the admin page automatically, including batch-categories.php from a plugins subdirectory.

  24. Don’t hesitate to release it yourself in the meantime! I don’t really care if it’s me or somebody else who does it, as long as it’s available for people 🙂

  25. Firstly, I must once I got your plugin working, it was a boon.

    I have written a tutorial on the changes that need to be made to get it working in 1.5.1, and also appear on the admin menu.

    I also have hosted the changed files for download. If you have any objections to it, let me know and I will remove it.

    I also have a couple of ideas for improving the work flow
    Check my post at

  26. No objections at all, I’m very happy other people are stepping in to keep Batch Categories alive!

  27. Hi,
    I had this error, too
    Warning: Cannot modify header information – headers already sent by (output started […]

    The files had trailing spaces at the end, remove them and it’ll work.


  28. p.s.: I have to correct myself, with the current WP version the batch-categories.php file doesn’t work (I can’t post the php error log though, don’t have access to it)

  29. OK so I actually have 2 blogs into the same database with different URLs. There is the one in my link there and

    Because the wordpress blogs are installed in a subfolder, I think I am having some weird errors. What code do I need to fix to get this to work? Here are the errors:

    Warning: Cannot modify header information – headers already sent by (output started at /home/unfilter/public_html/North_South_Blog/wp-content/plugins/batch-access.php:11) in /home/unfilter/public_html/North_South_Blog/wp-admin/admin.php on line 10

    Warning: Cannot modify header information – headers already sent by (output started at /home/unfilter/public_html/North_South_Blog/wp-content/plugins/batch-access.php:11) in /home/unfilter/public_html/North_South_Blog/wp-admin/admin.php on line 11

    Warning: Cannot modify header information – headers already sent by (output started at /home/unfilter/public_html/North_South_Blog/wp-content/plugins/batch-access.php:11) in /home/unfilter/public_html/North_South_Blog/wp-admin/admin.php on line 12

    Warning: Cannot modify header information – headers already sent by (output started at /home/unfilter/public_html/North_South_Blog/wp-content/plugins/batch-access.php:11) in /home/unfilter/public_html/North_South_Blog/wp-admin/admin.php on line 13

    When I click on the plugin URI per instructions, I get this:
    Warning: main(North_South_Blog/wp-admin/admin-header.php): failed to open stream: No such file or directory in /home/unfilter/public_html/North_South_Blog/wp-admin/batch-categories.php on line 16

    Fatal error: main(): Failed opening required ‘North_South_Blog/wp-admin/admin-header.php’ (include_path=’.:/usr/local/lib/php’) in /home/unfilter/public_html/North_South_Blog/wp-admin/batch-categories.php on line 16

  30. I got it works on version 1.5.1 but it does not work anymore under 1.5.2. It loads but it does not show the category(s) of the listed posts.

    This script is over 1 year old. I hope somebody can update it for WordPress version 1.5.2 or later.

  31. Warning: Cannot modify header information – headers already sent by (output started at /home/fansubto/public_html/nicoyan/wp-content/plugins/batch-access.php:11) in /home/fansubto/public_html/nicoyan/wp-admin/admin.php on line 10

    i get that error when activating the theme …

  32. Nico, there are two spaces after the very last greater than sign in batch-access.php that you need to remove.

    All the same, it still doesn’t work for me. batch-categories.php brings up a totally blank window, and when yo view the source, it’s blank too.

  33. Yes, this script doesn’t work at all. I had Nico’s problem, and now I’ve got chrish’s problem. Can you please fix this, Steph?

  34. Hey, thanks for your effort, but it does not work (at all) on WP 1.5.2, the “plugin hack” had spaces after the closing php tag, that were causing the “headers already sent” error. I removed those. The link is pointing to the / directory and I have wp intalled on a folder, I figured and fixed, but the page itself shows nothing. I removed the comment for the line where it does a print_r on the post variable. It shows an empty array, as expected. The required files are there – no errors, but there is no other information on the page.

  35. I’ve just added a little hack to this wonderful admin panel (which unfortunatly generates lots of warning on WP 1.5.2

    Add this code (copied from wp-admin/edit.php)

        get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts ORDER BY post_date DESC");
            foreach ($arc_result as $arc_row) {
                $arc_year  = $arc_row->yyear;
                $arc_month = $arc_row->mmonth;
                if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] )
                    $default = 'selected="selected"';
                    $default = null;
                echo "';
                echo $month[zeroise($arc_month, 2)] . " $arc_year";
                echo "n";
            "  />

    Just after the category selector, and you’ll have a month selector for your batch moves.
    It works really smooth. Thanks a lot Stephanie !

  36. I also posted this over at as days pass by

    “All the batch changes work properly with the hack above, but the update’ feature does not work due to an incorrect ID #. I’m going to see if I can figure out why.”

    I am actually having a similar problem with WordPress 1.5.2. I can make batch changes to the entire group, but pressing the “Update” button next to each post has no effect. There’s no error message or anything — it just reloads the page without making any changes.

    Just for the heck of it, I tried Myles’s workaround, even though it was designed for a different version of WP… but it had no effect. Any ideas?

  37. Just another voice in favor of mass category management for WP 2.0 😉

  38. All I am getting is a blank page when I use batch-access.php to get to the batch-category.php file. I’ve looked for extra spaces and such (removed them) but like I said, I’m not seeing this page.

    Please help?

  39. Ahh…great plugin. I would love to use it but I’m currently on WordPress 2.0. Hope you’re working on a compatible version!

  40. Plugin looks great but unfortunately doesn’t work with wordpress 2.0.3 🙁

    Mike – Any chance of making your plugin so you can do more then one at a time?

  41. Very nice functionality (exactly what I was looking for)!
    I’ve changed the plugin a bit so it would work with WP 2.0, if you want I can send you the code.

  42. This plugin is exactly what I have been looking for. But looks like it doesn’t work in WP2. Any plans of making it work in WP2 in the near future?


  43. This looks like what I need for my WordPress too — going through many articles and categorizing them is such a chore! I read talk of a WP 2.0-compatible version up there, is this out somewhere? Please advise, I’d love to know! Thanx!

  44. Hi,

    I have installed the plugin on a 2.0.5 WP install.

    When I click the link nothing happens? I get a blank white screen which states “Done” in the browser status bar.

    I uploaded the files as per the instructions. Possibly not compatible with 2.0.5?

  45. I want to use batch-categories and in hurry therefore I save a page
    of ur code as batch-categories.php and drop it in wp-admin folder then
    when I try to access
    “” then code
    appeared. What shud I do?

  46. Pingback: Mehrere Beitr
  47. Unfortunately, after pointing my browser to the php file, I receive this error:

    Warning: require_once(../wp-includes/wp-l10n.php) [function.require-once]: failed to open stream: No such file or directory in /home/thebeach/public_html/blog/wp-admin/batch-categories.php on line 12

    Fatal error: require_once() [function.require]: Failed opening required ‘../wp-includes/wp-l10n.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php:/usr/local/ioncube’) in /home/thebeach/public_html/blog/wp-admin/batch-categories.php on line 12

    I did not notice a wp-l10n.php file in the includes folder. However, there was a l10n.php file. After renaming it and refreshing the browser, I still got the same errors.

    Thanks for any help! 🙂

  48. Bonjour Stéphanie,

    I would like to know if this great plugin is still up ?
    (as your article is from 2004 and the last comment from 2010)
    I didn’t find it when I search in the plugin base.
    Anyway, I just found your blog and please to find so many things to read 😉
    Have a nice day !

  49. Wow, well, I know it was replaced by some better-written code that does all this category stuff. But not sure if that plugin is still around! Sorry, you’d have to dig a bit. Try googling “bulk category editing” or “mass category editing”… Other than that, glad you like my blog!

Leave a Reply

Your email address will not be published. Required fields are marked *