Free auditStart free
GuideWordPress · Crawling

WordPress robots.txt

Find WordPress robots.txt, distinguish crawl rules from noindex, edit rules safely, and verify the live response.

4 min
read
6
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

WordPress generates a virtual robots.txt for a public site when no physical file is present. Check the live /robots.txt first, then use a host-level file or the robots_txt filter only when you have a specific crawl rule to add. robots.txt controls crawling, not indexing or privacy; use a page-level noindex directive when a URL should stay out of search results.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
01How it works

Check what WordPress serves

Open https://your-domain.example/robots.txt in a browser. WordPress core can generate this response dynamically; the absence of a robots.txt file in the WordPress media library does not mean the route is missing. A physical file at the site root may be served by the web server instead, so always inspect the URL visitors and crawlers receive.
  1. 1

    Check the response

    Request /robots.txt on the canonical host and confirm it returns a successful response with plain-text rules. If a CDN, proxy, or host is involved, verify the public response after the change, not only a local WordPress preview.

  2. 2

    Check the site visibility setting

    In WordPress, open Settings > Reading and inspect Search engine visibility. The option is labeled Discourage search engines from indexing this site. Keep it unchecked for a public site intended to appear in search.

  3. 3

    Check a representative URL

    Use Search Console's URL Inspection tool to review an important public page after editing crawl rules. Confirm the page can be crawled and that its canonical URL is the one you expect.

WordPress core's do_robots() builds the virtual response, and the robots_txt filter lets code modify its output. If you already have a physical robots.txt, editing a plugin-generated view may not change the file the server serves.

03Check it

Add a narrow rule only for a known crawl problem

Keep rules small and describe the path you intend to affect. For example, this rule asks crawlers not to fetch a private staging path. It does not secure the path, and it should not be copied onto a production site unless that path exists and the rule is intended.

WordPress core provides the robots_txt filter for changing generated output. A small plugin can use that filter, while a physical root file is another option if your hosting setup serves it. Test the final response after deployment. For a public site, core already appends a Sitemap: line for its own index (/wp-sitemap.xml) to the generated output, so add a line only for a different sitemap your live site serves.

Illustrative robots.txt rule
User-agent: *
Disallow: /staging/

Sitemap: https://example.com/wp-sitemap.xml
04Checklist

Common mistakes to catch before publishing

First2
Blocking /wp-admin/ but forgetting that WordPress core already includes a narrow rule for it on a public site. Inspect the generated output before adding a duplicate.
Blocking a URL that contains the only noindex directive. A crawler cannot fetch the page to read a directive it is blocked from seeing.
Next2
Assuming the Settings > Reading checkbox is a password or privacy control. It is not.
Editing a plugin or virtual preview while the web server serves a physical root file. Compare the public /robots.txt before and after the change.
Then1
Using a broad Disallow: / rule on a site that should be indexed. Verify a representative page and sitemap after any edit.

For the companion tasks, see the general noindex guide, WordPress XML sitemaps, and the robots.txt definition.

Sources · 6

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • wordpress.org
  • google.com
  1. 01WordPress robots.txt output functiondeveloper.wordpress.org · checked 2026-10-24
  2. 02WordPress robots_txt filterdeveloper.wordpress.org · checked 2026-10-24
  3. 03Reading Settings screen (WordPress.org Documentation)wordpress.org · checked 2026-10-24
  4. 04Introduction to robots.txt (Google Search Central)developers.google.com · checked 2026-10-24
  5. 05WP_Sitemaps::add_robots() | WordPress Developer Resourcesdeveloper.wordpress.org · checked 2026-10-24
  6. 06Block Search indexing with noindex | Google Search Centraldevelopers.google.com · checked 2026-10-24
Questions

Asked a lot.

5 questions people ask next, answered from the sources on this page.

01Where is robots.txt in WordPress?

It is served at the site root, usually https://example.com/robots.txt. WordPress can generate a virtual file when no physical root file is present, so check the public URL rather than looking for a media-library file.

02Does WordPress robots.txt prevent a page from being indexed?

No. A robots.txt rule controls crawling and does not guarantee removal from search results. If a page should be excluded, let Google crawl it and use a page-level noindex directive.

03How do I stop WordPress from discouraging search engines?

Open Settings > Reading and clear Discourage search engines from indexing this site for a public site meant to appear in search. Then inspect the rendered page and /robots.txt to confirm the live response.

04Why does WordPress robots.txt still show `Disallow: /` after I change the visibility setting?

Check whether the server is serving a physical root robots.txt, or whether a plugin, host, or CDN is supplying a cached rule. Since WordPress 5.3, the Reading setting adds a noindex,nofollow robots meta tag when the theme outputs wp_head; it no longer relies on Disallow: /. Inspect both the public robots response and rendered page source.

05Can I use robots.txt to hide a staging site?

No. A robots.txt file is public and does not restrict access. Protect staging with authentication or another access control; use crawl rules only as a crawler instruction.

Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane