how to query posts and auto assign category if post title has keyword
The first code will only do it for posts matching your query – i.e posts published that day. Something like $query = new WP_Query( ‘post_type=post’ ); should retrieve all the posts, and then you could loop through them and perform the necessary operation. A word of caution. Whenever a post is published, your function is … Read more