Is there a php function which can add/remove tags of posts? If not how would I do this?
I am looking for something like this:
add_tag($post_id, 'tag-name');
remove_tag($post_id, 'tag-name');
|
|
|
The key function you're looking for here is To add the tag 'awesome' to post 98,
Note that the To delete a tag, first pull up a list of the existing post tags using https://codex.wordpress.org/Function_Reference/wp_get_post_tags:
Then assemble a list of the tags you want to keep (which will exclude the one you're "deleting"), and replace the existing post tags with the new list:
|
|||
|