The WordPress robots file, called robots.txt, tells search engine crawlers which parts of your site they may request. Most sites only need a few lines, but one wrong rule can stop Google from crawling your whole website.
This guide shows you how to find your robots.txt in WordPress, edit it safely, test it and fix the mistakes that cause indexing problems.
What Is the WordPress Robots.txt File?
Robots.txt is a plain text file at the root of your domain, such as yoursite.com/robots.txt. Crawlers read it before they request pages. According to Google, a robots.txt file mainly manages crawler traffic and is not a mechanism for keeping a page out of Google. To keep a page out of search results, use a noindex tag or password protection instead.
WordPress usually serves a virtual robots.txt if no physical file exists. SEO plugins such as Yoast and Rank Math can also create or edit it for you.
How to Find Your WordPress Robots.txt
- Type your domain followed by
/robots.txtinto your browser. - If a file appears, that is what crawlers see.
- If you get a 404 error, WordPress has no file yet, or a cache or plugin is interfering.
How to Edit Robots.txt in WordPress
Option 1: Use your SEO plugin
Most SEO plugins include a file editor in their tools or settings. Open it, change the rules, save, then reload /robots.txt to confirm the update.
Option 2: Upload a physical file
Create a plain text file named robots.txt and upload it to your site root through your host’s file manager or SFTP. A physical file overrides the virtual one.
A safe starting template
Adjust this to your own site:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://yoursite.com/sitemap_index.xml
Google explains the syntax and testing steps in its guide to creating and submitting a robots.txt file.
Common WordPress Robots.txt Mistakes
| Mistake | What happens | Fix |
|---|---|---|
Disallow: / |
Blocks the entire site from crawling | Remove it or leave Disallow: empty |
| Search engine visibility box ticked | Asks search engines not to index the site | Untick it in Settings, Reading |
| Blocking CSS or JavaScript folders | Google may not render pages correctly | Allow the files pages need to display |
| Using robots.txt to hide private pages | URLs can still appear in results | Use noindex or password protection |
| Missing sitemap line | Crawlers find your sitemap more slowly | Add a Sitemap: line with the full URL |
The WordPress documentation notes that the “Discourage search engines” option is only a request, and it is up to search engines to honor it. Always uncheck it on a live site.
How to Test Your Robots.txt
- Open Google Search Console and check the robots.txt report in Settings.
- Use the URL Inspection tool on an important page and confirm crawling is allowed.
- Reload
/robots.txtafter every change to confirm the live file matches what you saved.
If pages are crawled but still missing from Google, read our guide on crawled, currently not indexed in WordPress. For a wider technical review, see our SEO tips for 2026.
Frequently Asked Questions (FAQ)
Where is the robots.txt file in WordPress?
It sits at the root of your site, at yoursite.com/robots.txt. WordPress may generate it virtually, or you can upload a physical file to the root folder.
Can I edit robots.txt without a plugin?
Yes. Create a text file named robots.txt, add your rules and upload it to your site root with SFTP or your host’s file manager.
Does robots.txt remove a page from Google?
No. Robots.txt controls crawling, not indexing. To keep a page out of search results, use a noindex tag or password protection.
Why does my WordPress site say blocked by robots.txt?
A Disallow rule, a ticked search engine visibility setting or a plugin is usually blocking crawlers. Check your robots.txt file and Settings, Reading, then retest the URL in Search Console.

