Hello,
Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.
Yes, you would need to code a little bit (or hire a freelancer) but it is possible.
You can modify any Schema with this filter:
/**
* Collect data to output in JSON-LD.
*
* @param array $unsigned An array of data to output in json-ld.
* @param JsonLD $unsigned JsonLD instance.
*/
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
return [];
}, 99, 2);
And you can get any ACF value with:
get_field('field_name',$id); // Being $id the post id
Looking forward to helping you. Thank you.
​​​​​​​
Thanks for your help.
Will that add to the schema or replace it all?
How would I add the brand for example? Like this?
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
$brand = get_field('marca_customfield',$id);
return [
'brand': "$brand"
];
}, 99, 2);
Thanks
-
This reply was modified 4 years, 1 month ago by Tiago Faia.
Hello,
This doesn’t replace schema, it adds schema to existing schema.
Your filter would be something as shown below:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
$brand = get_field('marca_customfield',$id);
$data[brand] = $brand;
return [];
}, 99, 2);
Hope this helps you. Thank you.
Hi,
Thanks but when I do that, my Product Schema disappears completely.
Hello,
We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.
It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:
https://wordpress.org/plugins/temporary-login-without-password/
You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):
https://wordpress.org/plugins/wp-security-audit-log/
We really look forward to helping you.
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.