json ld data
-
Is there a possibility this plugin will also output yoast json ld data in the future?
-
To be honest I wasn’t aware Yoast had added the json ld data, so I am actually very happy with your question 🙂 So to answer your question: yes there is a possibility our plugin will also output the Yoast json ld data! I will see to it that we will add it as soon as possible.
Thanks! Please give me a headsup when its done 😉
We just released a new version of our plugin, which now includes the json ld data. For each post/page/… you can find an array of JSON LD data in that object under
yoast_json_ld.Please let us know if this works for you!
This is perfect!
Since you are in fire, I have another question, I do not see the yoast meta and json ld appear for custom post types in the wp rest api?
The plugin should add the yoast meta and json ld for custom post types automatically. Unless you have created a custom WP_REST_Controller for it and have not implemented the
rest_prepare_POSTTYPEfilter. I just did a test and did see them in a custom post type I just created.
So if it isn’t working on your side, it is either because you have a custom WP_REST_Controller which doesn’t implement therest_prepare_POSTTYPEfilter (replacePOSTTYPEwith your actual post type name) or there is some caching which is serving cache from before you activated the WP REST Yoast Meta plugin. If it isn’t caused by any one of those, I am affraid I don’t know what might me causing it.By the way: we also just released a new version of our plugin to fix an inconsistency in the way the json ld data is parsed. We prefer DOMDocument parsing, but if that isn’t installed we try simplexml parsing instead. The two gave a different output of the json ld data, which we fixed. But depending on which is used on your server the output might have changed, so just a heads up 😉
This thread has been marked as resolved due to lack of activity.
You’re always welcome to open a new topic.
Thanks for understanding!
I found the problem, your hook is excuted before mine.
When i adjust
add_action( ‘init’, [ $this, ‘register_rest_prepare_hooks’ ] );
to
add_action( ‘init’, [ $this, ‘register_rest_prepare_hooks’ ], 50 );
Everything works as expected. Is this something you can change?
Is this really the
add_actionfor which you changed the priority? All this hook does is adding therest_prepare_POST_TYPEfilters. Are you sure you didn’t change the priority for therest_prepare_POST_TYPEfilters?By the way couldn’t you also solve it by changing the priority of your own hook to a priority lower than 10?
We are willing to change the priority, but we first want to make sure we are talking about the correct hook.
Yeah ofcourse, did not thought about that.
Thanks!
The topic ‘json ld data’ is closed to new replies.