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:
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.
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=andDisallow: /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
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.
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:
| Pattern | What 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 |
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
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.
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
- Fetch
yoursite.com/robots.txtin a browser and confirm the file you expect is the file being served. Plugins and hosts both sometimes override it. - Use the robots.txt report in Search Console to see the version Google last fetched.
- 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.
- 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
noindexwas the right tool instead.