Hello,
Thank you for contacting Rank Math for help with your location schema.
Please note that the main organization schema gets added to all pages on your website including specific location pages. To disable
To disable the default location schema for the page, please try the following code snippet:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if ( !is_page('bankruptcy-attorney-fort-lauderdale'){
return $data;
}
unset ($data['Place']);
unset ($data['organization']);
return $data;
}
You can follow this guide for how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Hope that helps. Please let us know if you have questions.
Hi, my developer has advised me that the code contains syntax errors and proposed the following fix (but it is throwing a wordpress error)
add_filter( ‘rank_math/json_ld’, function( $data, $jsonld ) {
if ( !is_page(‘bankruptcy-attorney-fort-lauderdale’)){
return $data;
}
unset ($data[‘Place’]);
unset ($data[‘organization’]);
return $data;
});
Please review and provide me with the correct codes.
Hello,
We apologize for that, please refer to this code instead:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
if ( !is_page('bankruptcy-attorney-fort-lauderdale')){
return $data;
}
unset ($data['Place']);
unset ($data['organization']);
return $data;
}, 99, 2);
Let us know how that goes. Looking 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.