• Resolved acr0bit

    (@acr0bit)


    Hi, I’m building my first custom WordPress theme and would like to make it Yoast-friendly. I have found out that I can use echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); to get the user’s input from the ‘snippet’ field.

    My question is: How can I do the same with the ‘focus keyphrase’? How can I implement it in my theme?

    Specifically, I would like to know what code I need to use in my header.php file to ‘get’ the keyphrase that the user has entered.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @acr0bit,

    Thanks for the question. Since the update to 14.0, Yoast SEO has moved away from using the default WordPress postmeta tables, so we no longer recommend using the get_post_meta function to access the SEO data.

    You can find examples of how to display this information in your theme templates using the Yoast Surfaces API. Unfortunately, we don’t have the focus keyphrase available as an option since that is intended to only be displayed on the edit screen and not visible to search engines.

    If you’d like to see this feature added, we recommend creating a new GitHub feature request for our developers.

    Thread Starter acr0bit

    (@acr0bit)

    Hi @priscillamc

    Thank you so much for your advice. It’s great to know about the Yoast Surfaces API – I will use it.

    Will also consider submitting a feature request on Github.

    Thanks again, much appreciated ??

    Plugin Support devnihil

    (@devnihil)

    @acr0bit Thanks for your reply and you’re very welcome. We are going ahead and marking this issue as resolved but please let us know if you require any further assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to get snippet for use in page template’ is closed to new replies.