• Resolved iansdell

    (@iansdell)


    I have a blog with more than 3,000 posts, and I’d like to add all of them to a new category.

    Using WordPress’s built-in bulk edit facility would mean applying the process to 214 ‘Edit Posts’ pages, 15 posts at a time.

    Does anyone know of a less laborious way of achieving what I want to do?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • BACK UP YOUR DATABASE FIRST!

    This SQL should do what you want (replace the 7 with the term_taxonomy_id of the new category):

    INSERT INTO wp_term_relationships
    (object_id,term_taxonomy_id,term_order)
    SELECT ID,7,0 FROM wp_posts
    where post_type = 'post'
    and post_status = 'publish'

    If the category order is important to you, replace the 0 with a number higher than the maximum number of categories assigned to any post to make this the last category.

    Not saying anything about the solution but just to point out that you can change the “Screen Options” Number of posts per page to 999 and thus bulk edit ‘almost’ a thousand posts at one time.

    With that said, I would certainly follow vtxyzzy’s wise advise BACK UP YOUR DATABASE FIRST!

    Thanks, Michael. That is a safer solution. It should automatically take care of the category order.

    Thread Starter iansdell

    (@iansdell)

    Perfect … thanks guys!

    Wow, never saw that one Michael.
    Note: it makes things quite slow on my older PC so OK for a one time operation but set it back later to 20 or something so that yo do not think that WP “freezes”.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add multiple posts to a new category retrospectively’ is closed to new replies.