Batch Category Editing For WordPress

[fr]

J'ai codé une extension à  WordPress qui permet d'éditer les catégories de nombreux billets en un coup. L'écran liste par exemple tous les billets d'une catégorie, accompagnés d'un certain nombre de selects. On effectue les modifications que l'on désire et on soumet le formulaire entier en une fois.

[en]

Update 13.07: A more recent version is out!

I had planned to give you a write-up of the beginning of my WordPress experience today. Unfortunately, I decided to clean up my categories somewhat before I did that, and I managed to badly mess things up.

The result is that I spent most of my day writing a Batch Categories admin screen to help me clean things up. It was something I had planned to do, and I suppose it will also be useful to other people.

If you want to play around: copy the code above into a file named batch-categories.php in your wp-admin directory. I highly recommend that you back up your wp_post2cat table before you get going. This script works for me, but hasn’t been tested much, and comes with no guarantees. It is not optimised either, so depending on how many posts and categories you list, the screen can very well take over half a minute to load!

There are still a few functionalities I want to add, in particular: assigning all listed posts to a category in one go (or removing them).

If you want pretty integration with the other screens of the Edit menu, you’ll have to tweak the navigation bar in edit.php, edit-comments.php, and moderation.php.

Update 24.06.04: I’ve uploaded a screenshot of the admin screen so you can see what it could look like.

Update II 24.06.04: Instead of hacking the Edit menu bars, you can also access the Batch Categories screen from the Plugins page: create a file called batch-access.php (e.g.) in your plugins directory. (Beware not to leave any whitespace after the ?>, though, or you’ll get errors. Promised, zips and more detailed documentation will follow.

Update 04.07.04: I tried using the script this morning, and it seems nastily broken (removed all categories for some posts). Use with caution, and get back to me if ever you hack it or modify it, I’m interested! I’ll look into this once I get back home from Vienna.

Update 12.07.04: The script now works as it should! Thanks to Ben and MooKitty for helping me nail the big nasty bug which was driving me bonkers! Two improvements I’m working on right now: making the code more efficient by using the category cache, and adding a “add all listed posts to category X” option.

7 Comments

  1. Posted 6/28/2004 at 11:38 am | Permalink

    Chouette ! Je ne dois plus passer par le cache Google pour lire ton blog :)

  2. Posted 6/30/2004 at 8:10 am | Permalink

    phthbbt

    Back online these days. Finally. Hoping it lasts a while.

    Thinkin’ ’boutcha.

    And then of course there’s that other business that’s coming up soon. ;-)

  3. Posted 7/24/2004 at 1:49 pm | Permalink

    Something else I found, in trying to edit all of my posts

    Choosing “All” from the Show Posts From Category dropdown produced no posts, while choosing “None” from that same dropdown produced all of my posts. Shouldn’t it be the other way around?

    BTW, what is “None” for anyway? Is it possible to have a post that is not assigned to a category with WP?

  4. Posted 7/24/2004 at 1:58 pm | Permalink

    You definitely have a point there! Actually, None and All are redundant. By default, the page lists posts from Any category — I’ll replace it by that in the code right now.

  5. Posted 1/4/2006 at 11:44 pm | Permalink

    Hi,
    sounds good but in Wordpress 2.0 and does not do much is there any way of getting it working for 2.0? Thanks

  6. Posted 4/4/2006 at 3:02 pm | Permalink

    Tries with with WP 2.0.2 to no avail. Any plans of making an update? Thanks!!

  7. Posted 6/15/2006 at 1:15 pm | Permalink

    Ive tried to use you plugin, but it wont load the page - appernly the headders have allredy been sent out :S

4 Trackbacks

  1. By Climb to the Stars (Stephanie Booth) on 7/13/2004 at 3:30 pm

    Batch Categories 0.9
    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.

  2. By LcF Weblog on 8/19/2004 at 11:37 pm

    Batch Category Editing For WordPress
    Sometimes I need to sort and edit categories for my past posts. It is great headache by using Wordpress default post edit mode. The fastest way to edit posts’ category is by firing SQL queries in phpMyAdmin, but it is not the easy way.

    This morning…

  3. d under: Blog WordPress — Jack @ 10:45 am

            Looking forward to trying this: (climbto thestars.org). Useful for when you import hundreds  [...]
    
  4. By Batch Category Editing For WordPress on 10/17/2007 at 1:54 pm

    [...] This could come in handy while working with WordPress posts—Batch Category Editing For WordPress [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*
« Back to text comment
Contact