NEWOur agents now make the SEO fixes on your site and check what worked →

WordPress robots.txt: What It Should Say

/

WordPress creates a virtual robots.txt for every site, and its default rules are fine for most sites: block /wp-admin/, allow /wp-admin/admin-ajax.php, and list your sitemap. Only add rules for a clear reason, never block /wp-content/ or /wp-includes/, and never use robots.txt to keep a page out of Google: use a noindex tag for that.

Free spreadsheet

Get the WordPress SEO Checklist

We email you the WordPress SEO checklist now, then 3 short emails on using it. Unsubscribe in one click. We never sell your data. Privacy

Where Is robots.txt in WordPress?

Open yoursite.com/robots.txt in your browser. That is the file Google reads.

In most cases there is no robots.txt file on your server at all. WordPress builds a virtual file on the fly each time someone asks for it. That is why you cannot find it in your files over FTP. If someone uploaded a real robots.txt file to the root folder of your site, that physical file wins and WordPress's virtual one is ignored.

This matters when you edit it:

  • Yoast SEO creates a physical file when you click "Create robots.txt file".
  • Rank Math edits the virtual file, so its editor does not work while a physical file exists.

What the Default WordPress robots.txt Says

A fresh WordPress site serves this:

Code
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://yoursite.com/wp-sitemap.xml
  • Disallow: /wp-admin/ keeps crawlers out of the dashboard.
  • Allow: /wp-admin/admin-ajax.php lets themes and plugins that load content through admin-ajax still work for Googlebot.
  • The Sitemap: line points to WordPress's core sitemap. When Yoast or Rank Math is active, the line points to their sitemap_index.xml instead.

A Good robots.txt for Most WordPress Sites (Copy This)

Code
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://yoursite.com/sitemap_index.xml

That is it. Change the sitemap URL to the one your site really uses (open it in a browser to be sure it loads). Most sites need nothing more.

Add a rule only when you have a crawl problem you can name. Two common ones:

ProblemRuleWhen to use it
WooCommerce cart and checkout crawledDisallow: /cart/ and Disallow: /checkout/ and Disallow: /my-account/These pages are useless in search. They also carry noindex in WooCommerce, so the rule only saves crawling
Endless filter URLsDisallow: /*?filter_ (match your filter plugin's parameter)Only if the filter URLs do not need to pass a canonical. Check first

Rules That Hurt WordPress Sites

These come from old guides and still show up on live sites:

  1. Disallow: /wp-content/ or Disallow: /wp-includes/. These folders hold your CSS, JavaScript and images. Google needs them to render your pages. Blocking them can make Google see a broken page.
  2. Disallow: / left over from staging. One line blocks the whole site.
  3. Blocking pages you want gone from Google. Google says robots.txt "is not a mechanism for keeping a web page out of Google" (Google Search Central). A blocked URL can still show in results if other pages link to it. Worse, Google cannot see a noindex tag on a page it is not allowed to crawl. To remove a page, use noindex and let Google crawl it.
  4. Blocking /tag/ or /category/. Same problem. If you do not want archive pages in Google, set them to noindex in your SEO plugin instead.
  5. Noindex: lines. Google stopped supporting noindex inside robots.txt in 2019. The line does nothing.

"Discourage Search Engines" Does Not Change robots.txt Anymore

Since WordPress 5.3, ticking Settings > Reading > "Discourage search engines from indexing this site" adds a noindex, nofollow robots meta tag to every page. It no longer writes Disallow: / into robots.txt (WP Tavern). So if your site is missing from Google and robots.txt looks fine, check that box next.

How to Edit robots.txt in WordPress

MethodPathNotes
Yoast SEOYoast SEO > Tools > File editorClick "Create robots.txt file" if none exists. Needs file editing to be allowed on your host
Rank MathRank Math SEO > General Settings > Edit robots.txtNeeds Advanced Mode. Does not work if a physical robots.txt file exists: delete that file first
All in One SEOAll in One SEO > Tools > Robots.txt EditorBuilds rules from a form
FTP or host file managerUpload robots.txt to the folder that holds wp-config.phpAlways works. The physical file overrides every plugin

After any edit, open yoursite.com/robots.txt in a private window to see what is live. If you use a page cache or CDN, purge it.

Should You Block AI Crawlers in WordPress robots.txt?

It depends on what you want, and each company now splits its crawlers by job:

BotCompanyWhat it doesBlock it if
GPTBotOpenAICollects data for model trainingYou do not want your text used for training
OAI-SearchBotOpenAIPowers ChatGPT search results and citationsAlmost never: blocking it can keep you out of ChatGPT answers
ClaudeBotAnthropicTrainingYou do not want your text used for training
Claude-SearchBotAnthropicSearch indexing for Claude answersAlmost never
Google-ExtendedGoogleControls use in Gemini models. Does not affect Google SearchYou want out of Gemini training, still in Search

Sources: OpenAI bots, Google's common crawlers, Search Engine Journal on Anthropic's three bots.

A common middle ground: block training bots, allow search bots.

Code
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: Google-Extended
Disallow: /

Also check your security plugin, host firewall or CDN. Some block AI bots by default, which overrides whatever robots.txt says.

How to Test Your robots.txt

  1. Open Search Console > Settings > robots.txt. It shows the file Google last fetched, when, and any errors.
  2. Use URL Inspection on one key page. If it says "Blocked by robots.txt", find the rule that matches.
  3. Check Search Console > Indexing > Pages for "Blocked by robots.txt". Every URL on that list should be one you meant to block.

How to Use This with an AI Assistant

Connect SEOmatic at https://seomatic.ai/mcp and ask: "Use check_site on mysite.com and tell me whether my robots.txt blocks Googlebot or the AI search crawlers. Show me the exact lines to change." check_site is free and needs no sign-in.

Let the Agents Do This on Your WordPress Site

SEOmatic's AI agents connect to WordPress, read your own Google Search Console data, and make the fixes from this checklist directly on your site:

  • Rewrite SEO titles and meta descriptions, including through Yoast or Rank Math
  • Add internal links and schema where they are missing
  • Set up redirects and fix pages blocked from Google

Each change can wait for your approval, one click undoes it, and the agents check it against how the rest of your site did. What they can change depends on your platform, and you see the full list before anything runs.

14-Day Trial for $1, credited to your first payment.

Frequently Asked Questions

digi-business-uk

Each local area page used to take us half a day to create and optimize.


With SEOmatic, we can create hundreds of pages in the same time, which helps our clients make the best use of their budget.


It's transformed how we deliver scalable SEO solutions.

will-hawkins

Will Hawkins

Marketing Director, Digi-Business UK

Give Your Site an SEO Team

Agents read your Search Console data, do the work, and prove what actually moved. You decide what ships.

  • You decide what ships
  • Verified live
  • One-click rollback

14-Day Trial for $1, credited to your first payment.