Hello,
Thank you for contacting Rank Math today.
Rank Math manages the sitemap dynamically and you can disable it by creating a static robots.txt file on the root of your site.
Looking forward to helping you. Thank you.
​​​​​​
I need a programmatic solution as better robots.txt also creates a virtual file.
Thank you,
Rusty
Hi Russell,
Thanks for the mail.
Kindly allow me to consult the dev on this and then I’ll get back to you.
Someone will be getting back to you soon.
Hello,
Please create a new file in your theme’s folder and name it rank-math.php
Then, add the below code inside to disable the robots.txt feature of Rank Math:
<?php
add_filter(
'rank_math/modules',
function( $modules ) {
unset( $modules['robots-txt'] );
return $modules;
}
);
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.