Hello,
Thanks for contacting us, and sorry for any inconvenience that might have been caused due to that.
Can you please share the code you applied to your site? So that we can take a look as well.
Looking forward to helping you.
Hello Sakib
Thanks for your prompt reply.
This is the code I used:
/**
* Filter to change the schema data.
* Replace $schema_type with schema name like article, review, etc.
* @param array $entity Snippet Data
* @return array
*/
add_filter( “rank_math/snippet/rich_snippet_{$schema}_entity”, function( $entity ) {
return $entity;
});
Hmmm…Now that I am looking at this code I can’t see anything to do with itemCondition, I think perhaps I am meant to modify it somehow. Sorry, I am learning and lack knowledge in this area.
Let me know if you need more info.
Thanks again
Hello,
The code you have entered is basically not complete. You need to specify a specific schema type for the variable $schema
.
Here’s an example implementation:
add_filter( "rank_math/snippet/rich_snippet_article_entity", function( $entity ) {
return $entity;
});
and since you have mentioned about itemCondition
, then you must be trying to edit your product schema, here’s an example:
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
$entity['offers']['itemCondition'] = 'newCondition';
return $entity;
});
Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.
Hi,
That’s awesome, would I run that code everywhere or just in the admin.
Another question, would I only see the changes in Rich Results Tester? as from what I can research you won’t be able to choose new for some products and used for others, just either new for everything or used for everything.
Thanks for your help.
Hello,
That’s awesome, would I run that code everywhere or just in the admin.
You can go ahead and run the code on the frontend only as that is meant for the Rank Math schemas to be generated on the frontend.
Another question, would I only see the changes in Rich Results Tester? as from what I can research you won’t be able to choose new for some products and used for others, just either new for everything or used for everything.
I’m not quite sure whether I fully understand the question. But I’ll do my best and please let me know if I still misunderstood.
The changes will only affect the frontend so the Rich Result Test will be able to see it. Google as well.
The code will be applied globally to the targetted schema, new or not.
Looking forward to helping you.
Hi
I believe I comprehend your explanation that the code is implemented globally, indicating that everything will be identical.
Thanks for all your help very much appreciated
Have a great week 🙂
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/#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.