I want to use post title with custom word as tag in wordpress for all posts. For example, I have the title "How to Create a Post in WordPress" and I would like the tag to look like "How to Create a Post in WordPress guide", "guide" is my word that I would like to add to each tag along with the name of the post. I have about 500 posts and would like to automatically add a tag with the post name my custom word to all posts
I found something like this, but I don't know how to modify it to add a custom word to the post title
CodePudding user response:
Use the code from the other question, and replace this:
wp_set_post_tags( $post_id, $post_title, true );
with this:
$tag_title = $post_title . ' Guide';
wp_set_post_tags( $post_id, $tag_title, true );
CodePudding user response:
Thank you! That's exactly what I meant