Hi @odar78
Just to clarify, when you say microdata do you mean you want to disable the Yoast SEO schema for a specific page of your website?
If not, would you please elaborate your requirement further?
Thread Starter
odar78
(@odar78)
Yes, you read that correctly, I want to disable the Yoast schema for a specific page on the site.
@odar78 Thanks for clarifying your requirement. You will need to use the code snippets and guide here https://developer.yoast.com/features/schema/api/#add-or-remove-graph-piecesto craft a custom solution that is only applied to those specific pages
Thread Starter
odar78
(@odar78)
Thank you for responding so quickly, but the documentation you submitted describes how to disable Yoast schema for the entire site. Please tell me the solution for one page.
Hi @odar78,
The ‘wpseo_json_ld_output‘ filter mentioned doesn’t allow you to disable the schema data for a specific page.
Yoast SEO does not have a filter that supports the feature you mentioned but thanks for the suggestion. You can submit a new feature request in our GitHub repository, so our developers can consider this when planning updates.
You can follow the progress of the issue on GitHub by subscribing to notifications or commenting on the issue.
This filter is enough for something like this. You should use conditionals (eg. is_page) to check which is current page/post/… before returning desired value.
Thread Starter
odar78
(@odar78)
If anyone is interested, here is the solution:
`
add_filter( ‘wpseo_json_ld_output’, ‘yoast_seo_json_remove_partial’ );
function yoast_seo_json_remove_partial() {
if ( is_single ( 123456 ) ) {
return false;
}
/* Use a second if statement here when needed */
}
Hi,
As a solution for the issue has been found we will close this in order to keep the overview. If you experience any more issues let us know by opening up a new topic!