WordPress.org

Ready to get started?Download WordPress

Forums

Mass assigning uncategorized posts to a category (18 posts)

  1. kaeru
    Member
    Posted 6 years ago #

    I have a large amount of posts that are not assigned to any category. I am looking for a painless way to assign these post to a category (or at least properly mark them as "Uncategorized").

    In WordPress, these posts are labeled as "Uncategorized", but are not linked to that category. Here's a screenshot of the Manage Posts screen with a few properly categorized posts and some that aren't.

    This is all probably due to a combination of migrations from previous WordPress installs and conversions of categories to tags.

    I could not find any plugins to help me with this. Nor could I find any documentation pages or support forum posts. I'm hoping someone can help me fix this.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

  3. kaeru
    Member
    Posted 6 years ago #

    Thanks for that Otto42. This is one of the plugins I tried. The problem is, it only allows you to select on assigned categories. Since the posts I'm trying to edit aren't assigned to any category, I can't get them to show up using this plugin. If only it would allow me to do negative selection: "show me all posts not assigned to any category"…

    I am thinking of just writing a PHP script to do this for me, but my SQL is rusty, so I'm hoping someone can help me get started with that.

  4. kaeru
    Member
    Posted 6 years ago #

    To elaborate: The posts I'm trying to edit aren't even assigned to the "Uncategorized" category. If you look at the screenshot in my first post, you'll see that some have the category "Uncategorized" linked, and some don't. Those that don't actually are not assigned to any category whatsoever. How this came to be, again, I have no clue. :-(

  5. madmblue
    Member
    Posted 6 years ago #

    Those that don't actually are not assigned to any category whatsoever. How this came to be, again, I have no clue. :-(

    It happened to me when I used the category-to-tag converter on the manage/category tab.

    All I'd like to be able to do is re-assign these "uncategorized" posts to a single category. Is this possible?

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    ... I don't understand, it is not possible for a post to not have a category. All posts must have at least one category, which is the default category of "Uncategorized".

    Editing the post and simply resaving it should fix it if something went wrong in your database, I expect.

    But if something's wrong with the database, then there's probably no generic way to fix it other than that.

  7. madmblue
    Member
    Posted 6 years ago #

    Editing the post does resolve it. But the idea of editing umpty-thousand posts one-by-one..... ewwwww.

  8. kaeru
    Member
    Posted 6 years ago #

    Exactly Madmblue. I have better things to do. :-(

  9. hamish
    Member
    Posted 6 years ago #

    I am having the same issues. I have a thousand or so posts assigned to 30 or so categories. I've tested the tag converter, but it then makes all those posts uncategorized. I NEED to still have them assigned to "a" category. There's no way to edit the uncategorized category...

    Any ideas someone...? :-/

  10. muteboy
    Member
    Posted 6 years ago #

    I have this problem too, after importing a load of posts from my old Blosxom blog. I tried editing the category directly in PHPMyAdmin, with no success so far. Batch Categories doesn't spot these posts when I filter for 'Uncategorized', so they are like orphan posts.
    Editing the post, then resaving does set the category correctly, but for 500 posts I don't want to do that.
    What is the database field for category setting? What couldn't I set it directly?

  11. zackisaiah
    Member
    Posted 6 years ago #

    I originally imported 600 posts from an xml file (exported from a wp2.1 public blog so I could edit it locally on 2.5.1.) When I used the category-to-tag converter, it left all of the posts in the mysterious "Uncategorized", uneditable category. Opening each post and re-saving assigned the post to the default post category, but I did not have time to do this 600 times.

    Batch Categories did not initially help because all 600 posts were unassigned, and therefor invisible to the plugin.

    Here's how I fixed the problem:

    1. Delete all posts in the "uncategorized" category. (Note: You'll need a backup of the posts from before the category-to-tag conversion. This is important.)

    2. Re-import the original posts. (Using the WordPress "Import" function.)

    3. Create a new, uniquely-named category.

    4. Install/activate Batch Categories, then use the plugin to add all the posts to the new, unique category.

    Tip: the plugin shows 15 posts per page by default. Open admin.php in the batch-categories plugin folder, and set this to a higher number on line 22: $per_page = 600; worked for me.

    5. Now, use the categories-to-tags converter, but deselect the box for the new, unique category you created.

    All posts will now have proper tags and be assigned to an active category.

  12. kaeru
    Member
    Posted 6 years ago #

    Gee, thanks zackisaiah, that looks like it should work, if I had a backup of the original posts that is, which I don't. :-( But thanks nonetheless. I think my only solution is some clever PHP/MySQL hacking…

  13. tgiokdi
    Member
    Posted 6 years ago #

    Holy crap. I now have over 9,000 posts that are exactly like what's in kaeru's screenshot.

    mother of a *&%$. There needs to be a warning somewhere that you're about to strip the categories off and there will be no way to get it back!!!

  14. kaeru
    Member
    Posted 6 years ago #

    In the end I bit the bullet and resaved every single post, tgiokdi. If I had a better solution I would have shared it with you. I think it's silly the posts aren't properly (un)categorized when doing this, but then, who am I?

  15. Stephanie Leary
    Member
    Posted 5 years ago #

    I ran into this problem after a Blogger import and category to tag conversion. I wrote a quick plugin to assign the default category to all the Uncategorized posts. It worked great on my 2.7b3 installation, but I'd love some feedback before I release it on the plugin directory. Download the zip and let me know how it goes. It should work for WP 2.3 and up.

  16. Stephanie Leary
    Member
    Posted 5 years ago #

    By the way, a bug has been filed to prevent the converter from letting this happen in the future. (Thanks for clarifying the situation there, Otto42.)

  17. Stephanie Leary
    Member
    Posted 5 years ago #

    The plugin is now available.

  18. tgiokdi
    Member
    Posted 5 years ago #

    oh my lord sillybean, you just saved me hours upon hours of work!

    thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic