Created
September 11, 2014 18:21
-
-
Save abrudtkuhl/71c82d4cc3f99032ddce to your computer and use it in GitHub Desktop.
WordPress Swap All Pages In Custom Taxonomy To Another Category
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', 'update_taxonomy'); | |
function update_taxonomy() { | |
$posts = get_posts( | |
array( | |
'post_type' => 'page', | |
'posts_per_page' => -1, | |
'tax_query' => array( | |
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