Is there any theme function code that put the first 3-4 post tags on WordPress Post Title. Let's assume I am creating a new article for my site and I added the below tags for my post

My Post Title - Wishing You a Very Happy Birthday

My Post tags - Balloon, Birthday, Wishes, Gift, Celebration, Party

I want to put the first 4 tags to my post title whenever I publish or save draft the post. My title should be like:

Wishing You a Very Happy Birthday - Balloon, Birthday, Wishes, Gift

I also want to add a custom text Greeting at the end of the post title.

  • You mean the tags with the lowest term id? There is no other order beside that.
    – fuxia
    Nov 7, 2021 at 10:41
  • Does it add all tags of the post? if you have 20 for example, will it add all of them?. Also this can cause duplication, because every time you edit/update the post it will append those tags again. Maybe it would be better to hook into the_title and append the tags there? Nov 7, 2021 at 11:05
  • @fuxia Please find the image reference. gcdn.pbrd.co/images/TQBampfOOxfZ.png?o=1 Nov 7, 2021 at 11:28
  • @Buttered_Toast No, I want to put only first 4 tags. I have unique tags on every post title. Nov 7, 2021 at 11:30
  • So … the first in alphabetical order?
    – fuxia
    Nov 7, 2021 at 11:39


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.