I’m using a headless WordPress with WP-API.

So, I’m exposing yoast data in the API. With something like this:

'yoast_wpseo_title' => wpseo_replace_vars(get_post_meta($post->ID, '_yoast_wpseo_title', true), $post)

I have default SEO titles with snippet variables set for each of my post types under search apperance -> content types.


Odd thing is that if the above default seo title for the post is modified, it seems to save and this function returns me the correct title.

But if the default title is unedited, then the above function returns null. Moreover, if I edit the title back to the default, it also returns null.

I’m not running into this with regular WordPress sites when using standard PHP functions to directly render these fields.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.