Description missing from yoast_head in REST API
I’m trying to make use of the yoast_head field added to WP REST API endpoints for a standalone front end / headless CMS scenario, but it looks like the description tag is missing from the field.
I’ve given an example but I’ve tried on a few sites and it seems to be the same.
- This topic was modified 2 years, 1 month ago by dominic_ks.
The page I need help with: [log in to see the link]
Plugin Support devnihil
@dominic_ks We’re sorry to hear you are experiencing this issue on your site.
We checked on the site and it looks like the version of Yoast SEO is 15.2.1.
Can you please confirm you are using the most recent version of Yoast SEO, version 16.1.1? You can learn more about updating here: https://yoast.com/help/how-can-i-update-my-free-plugin/
Also, can you confirm you are using WordPress 5.7? You can check by clicking on the W in the top left and selecting About. If you need to update, please check with your host provider. Please know that if you are using an older version of WordPress Core you may experience unexpected behavior with Yoast. This guide explains more: https://yoast.com/why-we-dont-support-old-wordpress-versions/`
Thanks for getting back to me, no that site is not updated but the dev version is, latest WP, latest Yoast SEO, tested with only this plugin active:
Thanks for your confirmation. It looks like you’re not using the correct Rest API endpoint to fetch the meta description from Yoast SEO on the relevant website. You’ll need to have the Rest API endpoint like the following and that shall show the meta description for you:
You can find more information about it here: https://developer.yoast.com/customization/apis/rest-api
We hope this helps!
Thanks, I appreciate the response, but I don’t believe this answers the question of why the description is not present in that response.
I have read the link you provided already, and it states:
When you’re retrieving a post like so:
https://example.com/wp-json/wp/v2/posts/1 or http://example.com/wp-json/wp/v2/posts?slug=hello-world, you’ll receive a normal WP REST API response, with an additional field: yoast_head. This additional field will contain a blob with all the necessary meta tags for that page.
This says that you can use either method to get the meta information.
I have actually found that this issue is specific to this site and the development site, on this site, the descriptions are included:
Assuming you agree the description tag should be included, are you able to help me debug this?
Thanks for your clarification. If the issue specific to the development site only, we’d like you to please perform a conflict check first. This will help us narrow down the exact cause and determine what the next steps are while saving you time.
The fastest way to do this is to deactivate all non-Yoast plugins and switch to a standard theme like Twenty Nineteen.
Test this on your development or staging site, if you have one. If not, we recommend using the Health Check & Troubleshooting plugin. This plugin allows you to run a conflict check without affecting normal visitors to your site.
As we can imagine that you’re unfamiliar with checking for conflicts, we’d like to point you to a step-by-step guide that will walk you through the process: How to check for plugin conflicts.
If you do not feel comfortable doing this yourself or if this does not solve your issue, our Yoast SEO Premium plugin comes with one year of (technical) support.
Thanks, I have already tried deactivating all other plugins and switching to default theme.
Thanks for your confirmation. Due to the nature of the issue, we’ll need to take a look at your setup. However, we are unable to do it here as this is a public forum.
So, if you have an active Yoast SEO Premium subscription or if you can consider buying one, we can investigate the issue further directly on your setup privately through email.
However, if you don’t wish to get the Yoast SEO Premium subscription, that’s completely fine. In this case, you’ll need to troubleshoot the issue further on your setup as we are literally out of any clue at this moment without taking a look at the setup. So, someone from the community might step forward as well who has experienced or familiar with the issue.
Thanks for your understanding!Plugin Support devnihil
We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.
- The topic ‘Description missing from yoast_head in REST API’ is closed to new replies.