Wordpress API Yoast默认网站标题,不保存代码段变量

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.

defaults

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.

Note: I understand This is plugin-specific. I've tried to get answers from the wordpress forum on Yoast, as well as wordpress stackexchange but to no avail.