Most WordPress robots.txt advice is copied from 2012 and does more harm than good. The file is useful, but it does a narrower job than people think, and on WooCommerce it is routinely used to try to fix a problem it cannot fix.

What WordPress gives you by default

If no physical robots.txt exists, WordPress serves a virtual one:

Default WordPress robots.txt

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

That is a sensible starting point. The admin area is blocked, and the AJAX endpoint that themes and plugins rely on stays reachable. For a straightforward blog, adding your sitemap line to this is close to all you need.

robots.txt blocks crawling, not indexing

This is the distinction that causes most of the damage, so it is worth being precise about it.

Disallow does not mean deindex

A disallowed URL can still appear in search results, usually with no description, if Google finds links pointing to it. To keep a page out of the index you need a noindex robots meta tag — and a crawler has to be able to fetch the page to see that tag. Blocking it in robots.txt guarantees the tag is never read.

So the two tools are not interchangeable. Use robots.txt to stop crawlers wasting time on URLs that do not need crawling. Use noindex to keep pages out of results. Using robots.txt for the second job reliably fails.

Writing Noindex: directives inside robots.txt does not work either. Google stopped supporting that, and it was never part of the standard.

What to block on a standard WordPress site

Less than you think. The honest position is that blocking URLs in robots.txt is mainly necessary when you have a genuine crawl problem — a large catalogue with faceted navigation, for instance — rather than as routine hygiene.

On an ordinary WordPress site, worth considering:

  • Disallow: /wp-admin/ with the admin-ajax exception — already there by default.
  • Disallow: /?s= and Disallow: /search/ — internal search result pages, which generate unlimited low-value URLs.
  • Disallow: */feed/ if your feeds are being crawled heavily and you do not need them indexed.
  • A Sitemap: line pointing at your XML sitemap.

What never to block

CSS and JavaScript

Google renders pages the way a browser does. Blocking /wp-content/ or theme assets means it sees a broken page and judges it accordingly. This advice persists from an era when it was briefly defensible.

Pages you want deindexed

Covered above — blocking them prevents the noindex tag from ever being read.

Also leave /wp-content/uploads/ alone unless you have a specific reason. Blocking it removes your images from Google Images.

What WooCommerce adds

This is where robots.txt earns its place. WooCommerce generates a large volume of URLs that have no business being crawled repeatedly: add-to-cart links, sorting parameters, currency switchers and filter combinations. On a big catalogue these can consume a serious share of crawl activity.

Patterns commonly worth blocking:

PatternWhat it stops
Disallow: /*add-to-cart=*Add-to-cart action URLs, which do nothing useful for a crawler
Disallow: /*?orderby=*Sort-order variants of the same category listing
Disallow: /*?filter_*Layered-nav filter combinations, which multiply fast
Disallow: /*currency=*Currency-switcher duplicates
Disallow: /cart/The cart page, which is per-session and worthless in search
Disallow: /checkout/Checkout, same reasoning
Disallow: /my-account/Logged-in account pages
Check your own URLs first

These patterns assume default WooCommerce permalinks. If your store uses translated slugs, a different filter plugin, or custom endpoints, copying this list blindly will either miss the real URLs or block something you need. Open Search Console's crawl stats and look at what is actually being requested.

A working starting template

WooCommerce robots.txt

User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /*add-to-cart=*
Disallow: /*?orderby=*
Disallow: /*?filter_*
Disallow: /cart/
Disallow: /checkout/
Disallow: /my-account/
Disallow: /?s=

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

Replace the sitemap URL with your own. If you use Yoast or RankMath the sitemap index is usually at /sitemap_index.xml; WordPress core sitemaps live at /wp-sitemap.xml.

Generate it without hand-editing
The robots.txt generator builds a valid file with WordPress and WooCommerce rules, adds your sitemap line, and lets you copy or download the result.

Test it before you trust it

  1. Fetch yoursite.com/robots.txt in a browser and confirm the file you expect is the file being served. Plugins and hosts both sometimes override it.
  2. Use the robots.txt report in Search Console to see the version Google last fetched.
  3. Test a few real URLs — a product page, a category page, a filtered URL — and confirm the first two are allowed and the third is not.
  4. Check Search Console a fortnight later for a rise in “Indexed, though blocked by robots.txt”. That warning means you blocked something that has links pointing at it, and noindex was the right tool instead.

Frequently asked questions

Does robots.txt remove a page from Google?
No. It stops crawling, not indexing. A blocked URL can still be listed, usually without a description, if other pages link to it. Use a noindex robots meta tag instead, and leave the page crawlable so the tag can be read.
Can I put Noindex: in robots.txt?
No. Google does not support noindex directives in robots.txt, and it was never part of the standard. Use the meta robots tag or an X-Robots-Tag header.
Should I block /wp-content/?
No. It contains your theme CSS and JavaScript, and Google renders pages fully. Blocking it makes your pages look broken to the crawler. It also removes your images from Google Images.
Should I block the cart and checkout pages?
Blocking them in robots.txt is reasonable on a busy store, since they are per-session and worthless in search. If they are already indexed, add noindex and leave them crawlable until they drop out, then block them.
Where is the robots.txt file in WordPress?
If no physical file exists at your web root, WordPress serves a virtual one. Yoast and RankMath both offer an editor, or you can upload a real robots.txt to the root, which takes precedence.
Do I still need a sitemap line if I submit in Search Console?
Not for Google, but it helps other crawlers discover it, and it costs one line. Include it.