WordPress.org

Forums

Adding Parent Category Retroactively (10 posts)

  1. nmallory
    Member
    Posted 9 years ago #

    Hi, all!

    I'm doing some blog-cleaning and I added a parent category and swept an old category under it. Now I want to go back and have all of the posts that are in the old category also show up under the parent category.

    Right now I'm having to go back and manually find all of the posts in the old category, edit, and select the new parent category, but since I've got almost 1000 posts, this is long and tedious and well I would rather be posting new posts.

    Is there an easier way? Maybe a plugin or an SQL command I can run? Something. Anything. Please. Save me.

    TIA.

  2. ladydelaluna
    Member
    Posted 9 years ago #

  3. nmallory
    Member
    Posted 9 years ago #

    But it doesn't look like it works on WP 2.0. :(

  4. ladydelaluna
    Member
    Posted 9 years ago #

    i'd try it - it doesn't say on matt's list that it does or doesn't... http://codex.wordpress.org/User:Matt/2.0_Plugin_Compatibility and i've seen other people refer to it fairly recently...

    i'd just see if it works - maybe try it on another site or something? i dunno - i doubt any issue you'd have would be severe... i just don't think the plugin dev has updated it is all.

  5. moshu
    Member
    Posted 9 years ago #

    That didn't work even with 1.5...

  6. ladydelaluna
    Member
    Posted 9 years ago #

    oh... well, i'd seen that podz had recommended it a few times, so i thought it did.

    sorry, mallory... :(

    any bright light ideas here, moshu?

  7. ladydelaluna
    Member
    Posted 9 years ago #

    http://wordpress.org/support/topic/25084?replies=49 - here's a thread i found on fixing it... to make it work. didn't read through the whole thread, but there are some ideas in there to make it work.

    and this guy seems to believe he got it working with help from that thread: http://www.garypaulson.net/archives/batch-categories-hack/

  8. nmallory
    Member
    Posted 9 years ago #

    Really there should be a way to write an SQL statement to say something like,

    For all in wp_post2cat that match category_id = 29, then insert a row with category_id = 51 and the post_id.

    However, SQL is not my forte. I've been looking at an old SQL book trying to figure it out.

  9. nmallory
    Member
    Posted 9 years ago #

    How about this? Would this do it?

    INSERT INTO 'wp_post2cat' (post_id, category_id)
    VALUES ((SELECT post_id FROM 'wp_post2cat' WHERE 'category_id' = '29') ,'51')

    29 = child id
    51 = new parent id

  10. nmallory
    Member
    Posted 9 years ago #

    This SQL code should have worked, but it for some reason, I get an old SQL error about trying to insert from the selected table.

    I guess I have to give up and do it manually.

Topic Closed

This topic has been closed to new replies.

About this Topic