-
im trying to disable the schema code generated by rankmath
-
Hello, we’re sorry to hear that you’re facing issues with the schema generated by Rank Math. To disable the schema code generated by Rank Math, you can follow these steps:
-
Navigate to Theme File Editor: Go to your WordPress Dashboard → Appearance → Theme File Editor.
-
Edit Your
rank-math.php
File: Click on the rank-math.php file from the right sidebar that lists all the files in your theme.
-
Add the Code Snippet: Insert the following code snippet into your
rank-math.php
file:/** * Function to disable Schema generated by Rank Math */ function rankmath_disable_schema() { remove_all_actions( 'rank_math/schema' ); } add_action( 'wp_head', 'rankmath_disable_schema', 1 );
-
Update the File: After adding the code, click the Update File button to save your changes.
This code will effectively disable the schema generated by Rank Math on your site. If you have any further questions or need assistance, please reply to this ticket, and a human agent from our support team will assist you further.
Sources:
Remove Organization Schema from Your Website » Rank MathThis is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.
I want to disable on the homepage .. not on the product page
Hello,
Thank you for contacting us. We apologize for any inconvenience this issue may have caused.
If you only want to use the Schemas that you have created and remove the default Schemas, please use the following filter:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) { if (isset( $data['publisher'] ) ) { unset( $data['publisher'] ); } unset( $data['place'] ); unset($data['WebPage']); unset($data['WebSite']); unset($data['ImageObject']); unset($data['ProfilePage']); unset($data['primaryImage']); return $data; }, 99, 2);
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.
If you don’t want Rank Math to add any schema markup to your site:
Go to your WordPress Dashboard → Rank Math → Titles & Meta.
Open each post type tab (Posts, Pages, snaptube mod sem anúncio, etc.).
Scroll down to the Schema Type setting.
From the dropdown, select “None”.
Click Save Changes.
👉 This disables automatic schema generation for that post type across your site.
Will this code disable the schema for the entire website or only for a single page?
Can I use the same code if I want to disable the schema only on the homepage of the website?Hello,
The filter will disable all the automatic schemas from your whole site.
To apply it to your homepage only, you may need to add a condition to the filter:
add_filter( 'rank_math/json_ld', function( $data, $jsonld ) { if ( ! is_front_page() ) { return $data; } if ( isset( $data['publisher'] ) ) { unset( $data['publisher'] ); } unset( $data['place'] ); unset( $data['WebPage'] ); unset( $data['WebSite'] ); unset( $data['ImageObject'] ); unset( $data['ProfilePage'] ); unset( $data['primaryImage'] ); return $data; }, 99, 2 );
Looking forward to helping you.
-
You must be logged in to reply to this ticket.