how to programmatically change post tags
The key function you’re looking for here is wp_set_post_tags(). To add the tag ‘awesome’ to post 98, wp_set_post_tags( 98, array( ‘awesome’ ), true ); Note that the true parameter means that this tag will be added to the existing post tags. If you omit this value, it defaults to false, and the existing post tags … Read more