I am writing plugin. I want to add tag "video" to post, when it is published or edited if this post has some special value in Custom Field.
I know how to check if post has this custom field.
I know how to make some action when post is published: add_action('publish_post'...
but i don't know how to add tag 'video' in this action. what should be in function?