Hello @vsandersssi, I’m sorry it took a while to get a response on the topic; I had to consult with senior support engineers.
Yoast SEO doesn’t create a robots.txt file automatically. WordPress dynamically includes one, which we hook into unless you manually create the file on the server; this is doable via our plugin with the click of a button. So, there’s no way to disable or prevent the creation.
Since you’re in a multisite environment with subdomains, that block of text in the file can’t be removed. But there’s a filter to disable the subsites sitemap link from robots.txt. Further information is available here: https://github.com/Yoast/wordpress-seo/pull/18909.
Please submit a feature request for our product team on GitHub at https://github.com/Yoast/wordpress-seo/issues
You may also consider customizing the robots.txt crawl rules using Yoast SEO’s hook instead of writing yours. But again, there’s no way to remove the existing crawl rules. Here’s the relevant hook to work with https://github.com/Yoast/wordpress-seo/blob/f43026341e91e40bae9950ff9f6f4dae616bf172/src/integrations/front-end/robots-txt-integration.php#L97
Once again, I apologize for the time it took to get back to you.
-
This reply was modified 2 years, 4 months ago by
Maybellyne.