Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WordPress Swap All Pages In Custom Taxonomy To Another Category
add_action( 'init', 'update_taxonomy');
function update_taxonomy() {
$posts = get_posts(
'post_type' => 'page',
'posts_per_page' => -1,
'tax_query' => array(
'taxonomy' => 'content_category',
'field' => 'slug',
'terms' => 'news-releases'
foreach ($posts as $post) {
wp_set_object_terms($post->ID, 'featured', 'content_category');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.