- Hook into
publish_post
. - Check if the post is in the category
news
. -
Get all posts with that category:
$query = new WP_Query( array( 'category_name' => 'news', 'posts_per_page' => -1 ) );
- Update the category of the oldest post if necessary:
wp_set_post_terms()
.