Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
You can use the following hook to disable the product rich snippet on your site. The code should be added to your theme’s functions.php file:
/**
* Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
* Replace $schmea_type with schema name like article, review, etc.
* @param bool $value true/false Default false
* @param array $parts Post Data
* @param array $data Schmea Data
*
* @return bool
*/
add_filter( "rank_math/snippet/rich_snippet_{$schema_type}", function( $value, $parts, $data ) {
return true;
}, 10, 3 );
Looking forward to helping you. Thank you.
Sorry if I’m just to stupid, but sincd i cannot find any examples of this Function and i am for sure not WordPress developer, i am not sure how to use it…
Functions.php:
/**
* Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
* Replace $schmea_type with schema name like article, review, etc.
* @param bool $value true/false Default false
* @param array $parts Post Data
* @param array $data Schmea Data
*
* @return bool
*/
add_filter( “rank_math/snippet/rich_snippet_{product}”, function( $value, $parts, $data ) {
return true;
}, 10, 3 );
My Product
Snippet Test (Product is still there)
To be clear: If i would set the Rank Math Snippet to “None”, the Snippet will disappear in the Testing Tool to. (This is what i am trying to achieve). But I would have to set 150+ Product manualy, because the Plugin is missing an option to apply changes of Global Settings to existing Products.
Could you assist me a little further?
Thanks in advance
Simon
Hi there,
Thanks for getting back to us.
You can add the following code to your functions.php file to achieve this:
/**
* Filter to Short-circuit Schema if a 3rd party is interested in generating their own data.
* Replace $schmea_type with schema name like article, review, etc.
* @param bool $value true/false Default false
* @param array $parts Post Data
* @param array $data Schmea Data
*
* @return bool
*/
add_filter( "rank_math/snippet/rich_snippet_product", function( $value, $parts, $data ) {
return true;
}, 10, 3 );
I hope this info helps. Thank you.
I see, I really have been a little stupid ^^
Thank you so much, your code worked!
Sincerely,
Simon
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/?rate=5#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.