Title: Adding Parent Category Retroactively
Last modified: August 18, 2016

---

# Adding Parent Category Retroactively

 *  [nmallory](https://wordpress.org/support/users/nmallory/)
 * (@nmallory)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/)
 * 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.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [ladydelaluna](https://wordpress.org/support/users/ladydelaluna/)
 * (@ladydelaluna)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425138)
 * [http://climbtothestars.org/archives/2004/07/13/batch-categories-09/](http://climbtothestars.org/archives/2004/07/13/batch-categories-09/)
 * try that one 😉
 *  Thread Starter [nmallory](https://wordpress.org/support/users/nmallory/)
 * (@nmallory)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425142)
 * But it doesn’t look like it works on WP 2.0. 🙁
 *  [ladydelaluna](https://wordpress.org/support/users/ladydelaluna/)
 * (@ladydelaluna)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425170)
 * 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](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.
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425171)
 * That didn’t work even with 1.5…
 *  [ladydelaluna](https://wordpress.org/support/users/ladydelaluna/)
 * (@ladydelaluna)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425172)
 * 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?
 *  [ladydelaluna](https://wordpress.org/support/users/ladydelaluna/)
 * (@ladydelaluna)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425174)
 * [http://wordpress.org/support/topic/25084?replies=49](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/](http://www.garypaulson.net/archives/batch-categories-hack/)
 *  Thread Starter [nmallory](https://wordpress.org/support/users/nmallory/)
 * (@nmallory)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425192)
 * 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.
 *  Thread Starter [nmallory](https://wordpress.org/support/users/nmallory/)
 * (@nmallory)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425233)
 * 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
 *  Thread Starter [nmallory](https://wordpress.org/support/users/nmallory/)
 * (@nmallory)
 * [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425332)
 * 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.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Adding Parent Category Retroactively’ is closed to new replies.

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)
 * [parent](https://wordpress.org/support/topic-tag/parent/)
 * [post2cat](https://wordpress.org/support/topic-tag/post2cat/)
 * [sql](https://wordpress.org/support/topic-tag/sql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [nmallory](https://wordpress.org/support/users/nmallory/)
 * Last activity: [19 years, 10 months ago](https://wordpress.org/support/topic/adding-parent-category-retroactively/#post-425332)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
