WordPress robots.txt generator
Start from the robots.txt that WordPress already serves, add only what you need, and test any address against the rules before you publish.
Everything runs in your browser. Nothing you type is sent anywhere or saved. The tester cannot fetch your live file, so paste its text in.
Your robots.txt
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow asks crawlers not to visit an address. It does not remove a page from search results, and it does not hide anything. Anyone can read this file. For a private page, use a password or a noindex tag.
How to put it on your site
- Click Download. You get a file named
robots.txt. - Upload it to the folder that holds
wp-adminandwp-includes(your site root, next towp-config.phpin a standard install). Use your host's File Manager or FTP. - Open
yoursite.com/robots.txtin your browser. You should see exactly this text. - Paste it into the tester below and try your important pages.
How to undo it
Delete the robots.txt file you uploaded. WordPress then serves its own again. Search engines can take a day or more to notice a change.
Test an address against the rules
This checks one address at a time the way a crawler reads the file (RFC 9309). It does not fetch your site. To test your live file, open yoursite.com/robots.txt, copy the text and paste it in the box.
A full address or just the path. A path may include ?s=shoes.
Blocked
Googlebot may not visit /wp-admin/.
Decided by line 2: Disallow: /wp-admin/. It is the matching rule with the longest path. The crawler follows the * group (line 1).
- 1User-agent: *
- 2Disallow: /wp-admin/
- 3Allow: /wp-admin/admin-ajax.php
- 4
Yellow: the line that decided. Blue: the group this crawler followed.
Problems found in the text
No problems found. Lines are read the way RFC 9309 says.
How it works
Without a real file, WordPress writes a robots.txt for you when a crawler asks for it. This tool starts from those lines, adds the options you tick, and gives you a text file to upload.
What each part does
- The WordPress lines keep crawlers out of
/wp-admin/but let them reachadmin-ajax.php, which some themes and plugins use on the public side. - The Sitemap line tells search engines where your list of pages is. WordPress's own list is at
/wp-sitemap.xml. - Your options add Disallow lines. A crawler that follows the rules skips those addresses.
- The tester reads the file the way RFC 9309 describes. It picks the group for a crawler by its name, then the longest matching rule. If an Allow and a Disallow match equally well, Allow wins.
*matches any text and$marks the end of an address. Matching is case-sensitive.
What it does not do
- It does not read or change your site. You upload the file yourself.
- It does not hide pages. Disallow is a polite request, and the file is public.
- It does not fetch your live robots.txt. Open it in your browser and paste the text.
- It cannot tell you how a search engine will rank a page. It shows whether a crawler is asked to visit it.
If you would rather not upload a file, the free WellTend Site and Admin Toolkit has a Manage robots.txt module. It lets you edit the text WordPress serves from the dashboard, and it writes nothing to disk.
Sources
The default lines and the sitemap line come from WordPress's own source (do_robots() and the core sitemaps class). The matching rules come from RFC 9309 and Google's description of it. The tests include the examples from both. See also Harden WordPress security.
FAQ
Does my WordPress site already have a robots.txt?
Yes, a virtual one. If there is no real robots.txt file in your site folder, WordPress builds the text when someone asks for /robots.txt. The default is User-agent: *, Disallow: /wp-admin/ and Allow: /wp-admin/admin-ajax.php, plus a Sitemap: line that points to /wp-sitemap.xml when your site is public. That is the base this tool starts from.
What happens when I upload a real robots.txt file?
The real file replaces the virtual one. On Apache, the rules WordPress writes into .htaccess only pass an address to WordPress when no real file or folder matches it, so a real robots.txt is served as it is. WordPress stops adding its own lines, including the Sitemap: line, so the file you upload must hold everything you want. To go back, delete the file.
Where do I upload the file?
In the folder that holds wp-admin and wp-includes. In a standard install that is the same folder as wp-config.php. Use your host's File Manager or FTP. Then open yoursite.com/robots.txt in your browser to check that you see your text.
I ticked "Discourage search engines from indexing this site". Does a real file change that?
A real file does not know about that setting. In the current WordPress source, that setting adds a noindex tag to your pages and leaves the Sitemap: line out of the virtual file. A real file with a Sitemap: line says the opposite. If the site is meant to stay hidden, do not add sitemap lines.
Will Disallow remove a page from Google?
No. Google says a page blocked in robots.txt can still be indexed if other sites link to it, and the result then has no description. To keep a page out of search, use a noindex tag or a password. Do not block that page in robots.txt as well, because then Google cannot see the noindex tag.
Is robots.txt a way to hide private pages?
No. It is a public file that anyone can read, and a rude crawler can ignore it. Listing a private address in it tells people where it is. Use a password for anything private. The standard itself says these rules are not a form of access authorization.
Why does the tool warn me about wp-content, wp-includes, CSS and JavaScript?
Your theme's styles and scripts live in those folders. Google says you may block resource files you think pages will not miss, but if a page is harder to understand without them, do not block them. A page that looks broken to Google can be judged badly. The warning appears when a rule stops a typical theme or core file.
Which AI crawlers can I block, and does it work?
GPTBot (OpenAI), ClaudeBot (Anthropic), Google-Extended (Google) and CCBot (Common Crawl). We used only the names each vendor lists on its own page. It is a request. Crawlers that follow robots.txt will honor it, others can ignore it, and it does not remove anything already collected. Google says Google-Extended does not affect Google Search. We left out search crawlers such as OAI-SearchBot and PerplexityBot, because their vendors say they are for search results.
What about Crawl-delay?
It is not part of the standard (RFC 9309), and Google says it does not support it. Anthropic's page says its bots support it. We do not add it. The tester warns when it sees one.
How big can the file be?
Crawlers must read at least 500 KiB (RFC 9309), and Google ignores everything after 500 KiB. A WordPress file is tiny, but the tester warns if pasted text is larger.
My WordPress is in a sub-folder, or I moved wp-admin.
This tool writes the standard /wp-admin/ lines and uses only the top of your site address. If your admin lives somewhere else, change those lines by hand. A robots.txt file only counts when it is at the top of the address, such as example.com/robots.txt.