Hello,
Thank you for your query and we are so sorry about the trouble this must have caused.
Unfortunately, our %customfield(...)%
doesn’t support array data as it only renders strings. What you can do here is create a custom variable using this guide and return a processed array data as a string. Maybe implode them with a comma separator.
Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.
Hello Jeremy,
I am having difficulty adding the %customfield(…)%, which is an Advanced Custom Fields (ACF) field, to the rating field. Is there any way?
Image – https://i.ibb.co/Dkcb6q0/rating-field.png
Thanks
Hello,
You can use the following variable %customfield(field-name)%
to retrieve the rating from a field and use it in your schema.
If you are fetching the field value from a specific post type, then you may need to make use of our custom variable instead.
Looking forward to helping you.
But I am unable to type in the rating field because it is a number type field. How can I add %customfield(field-name)% into the number type field.
Image – https://i.ibb.co/Dkcb6q0/rating-field.png
Hello,
Apologies for the confusion, our schema builder doesn’t accept those entries if the fields are meant for numeric entries only.
We can resolve this by creating a filter code for you. Can you please share with us which type of schema you are working on?
We really look forward to hearing back from you. Thank you.
Hello Jeremy,
I am using movie schema.
Thanks
Hello,
You can use the following filter:
add_filter( "rank_math/snippet/rich_snippet_movie_entity", function( $entity ) {
$entity['review']['reviewRating']['ratingValue'] = get_field('YOUR_RATING_FIELD', get_queried_object_id());
return $entity;
});
Here is how to add a filter to your site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps, and please do not hesitate to let us know if you need our assistance with anything else.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.