Hello,
We apologize for the issue you are facing with Rank Math injecting its default schema even after you’ve added custom JSON-LD schema manually. Thank you for raising this concern.
To disable Rank Math schema on specific pages while keeping your global SEO settings intact, you can indeed use the rank_math/json_ld
filter. Here’s a clean way to do it:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
// Check if we are on a specific page by ID or slug
if ( is_page( 'your-page-slug' ) || is_page( 123 ) ) { // Replace 'your-page-slug' and 123 with your actual page slug or ID
return []; // Return an empty array to remove Rank Math's schema
}
return $data;
}, 99, 2 );
This code snippet checks if the current page matches the specified slug or ID and returns an empty array, effectively removing Rank Math’s schema for those pages. You can add this code to your theme’s functions.php
file or a custom plugin to ensure it remains update-proof.
If you have multiple pages, you can extend the condition within the if
statement accordingly.
For further assistance or if you have any more questions, feel free to reply to this ticket, and a human agent from the Rank Math Support team will assist you further.
Thank you for your understanding!
Sources:
Removing Schema From Your Posts & Pages » Rank Math
Remove All Schema from Product Category Pages » Rank Math
Remove Organization Schema from Your Website » Rank Math
Hello,
Thank you for contacting us and bringing your concern to our attention.
You can use the following filter code on your website to disable the Rank Math Schema on a specific page:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if ( strpos( $url, 'your-page-url' ) !== false ) {
return [];
}
return $data;
}, 99, 2 );
Please replace the your-page-url
with the actual page URL.
Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how it 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.