Hello,
Thank you for getting in touch and I am extremely sorry about the trouble this might have caused.
I am sorry but the site navigation schema is not currently available in Rank math.
Assuming you wish to add this to gain sitelinks, I’d like to note that this doesn’t actually influence the sitelinks currently you can check this thread: https://support.google.com/webmasters/thread/13954295?hl=en. Rank math usually adds the sitelinks searchbox for this.
If you still wish to add this schema to your site, you can generate this schema by following this guide: https://schema.org/SiteNavigationElement then use the following filter to extend Rank math schema:
/**
* 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);
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Where should I put this code?
functions.php?
Hello,
Yes,It should be added in theme’s functions.php file. You should however customize it accordingly.
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.