I have a question. I want to add a tag automatically on my posts but I don’t know how to do it .
I tried to use : wp_set_post_tags()
but nothing.
Help please. Thanks in advance.
I have a question. I want to add a tag automatically on my posts but I don’t know how to do it .
I tried to use : wp_set_post_tags()
but nothing.
Help please. Thanks in advance.
You must be logged in to post a comment.
Spent a hot minute looking for a solution to this same problem. Just found it by combining a few solutions to semi-related requests, thought I’d share. You are the right track with wp_set_post_tags() but the key is to set the tag on publish so that an ID can be passed. The following code will add the tag “archive” once published. Note that I’m using a custom post type of “andytoday”, you’ll need to change that to “post” for standard usage or your specific custom post type name if applicable. Add this to functions.php and rename the function accordingly. Dont for get to rename in the hook as well.
Maybe this plugin? Simple Tags
THE SOLUTION