WordPress Mass Update Post, Page, or Custom Post Type Taxonomies

September 11, 2014

wordpress

I'm working on a massive WordPress migration project and after we defined taxonomies they needed to be changed or updated. I tried doing this with SQL but that turned into an Inner Join nightmare due to how taxonomies are related to posts in the database. This script also comes in handy if you want to run mass updates to add all posts to a new category. When you are dealing with thousands of pages doing this manually in the WordPress admin becomes tedious. So, you can drop these handy little scripts in your theme's functions.php file for one time updates. These work for posts, pages, custom post types along with categories, tags, and custom taxonomies.

Apply Category To All Posts

Swap All Pages From One Custom Taxonomy Category To Another

This is one of the main reasons I wrote this script. We had hundreds of miss-classified pages in our custom taxonomy and I wanted to swap everything categorized as "News Releases" to another category called "Featured". As mentioned above Hopefully this saves you some time. Let me know in the comments if you have any questions.