Our today's topics are how to set default tags for the post in WordPress. To set default tags for posts we can create a plugin or we can write a function in the WordPress theme function.php file. We can write a function for these topics as following -
add_action('publish_post','add_default_tags');Update function.php or if you write a plugin then active it.
function add_default_tags(){
$postId=get_the_ID();
$tags=array('Programming','Tutorial');
wp_set_post_tags($postId,$tags,true);
}
Now write a post and publish it then see it automatically add those tags.