I would like to add a meta value to the title <title> tag in a custom post typed page. So there would be meta value before normal post title. I have a custom field created that contains the needed data, but I don't know how to show it in the <title>. I can show it in pages <h1> in a template file, but I need the title tag to start with that data.

How to do this? My theme uses <?php wp_head(); ?> and add_theme_support( 'title-tag' ); to print title.

  • 1
    I think you are confused, o maybe I don't fully understand your question. Do you refer to document tilte (<title> element, what you see in browser tabs) o the title of the post you see in the within the page?
    – cybmeta
    Commented Mar 15, 2016 at 15:37
  • I guess you are talking about custom field value to be concatenated with the page title. Can you please, at least, show us how do you create this custom field and how do you output the page title.
    – Max Yudin
    Commented Mar 15, 2016 at 15:51
  • Updated question. Question refers to <title> tag. Commented Mar 17, 2016 at 8:42

1 Answer 1


What I actually ended up doing was to use filter document_title_parts. https://developer.wordpress.org/reference/hooks/document_title_parts/

I just unshifted a value to the array. I don't think the documentation actually is very clear about that.

And this method still don't work with Yoast SEO installed.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.