AI bots

How to block or allow AI crawlers on WordPress

WordPress builds robots.txt unless a real file exists. Three ways to block AI training crawlers, allow AI search and test the result.

On this page 7 sections

On WordPress you block or allow AI crawlers in robots.txt, with one rule group per bot. WordPress creates that file for you, so first find out whether yours comes from WordPress, a real file on the server, or a plugin.

Where your robots.txt comes from

Yoast's help page says that "WordPress generates a virtual robots.txt file if the site root does not contain a physical file". Nothing is stored on disk: WordPress builds the answer when a bot asks. The function is do_robots(), and the filter robots_txt "filters the robots.txt output".

A real file wins. The default WordPress .htaccess rules hand a request to WordPress only when no file or folder matches the path, so a robots.txt in the site root is served as it is and the filter never runs. One plugin's listing says it only works when no physical file exists.

Open https://example.com/robots.txt with your own domain, then look in the site root over SFTP or your host's file manager. If there is a file, edit it. If not, use a plugin or the filter.

Three ways to change it

Route Good for Trade-off
A physical robots.txt file Full control, no plugin You edit it by hand. WordPress and plugins can no longer change it, and a typo has no safety net
An SEO plugin's editor Sites that already run one The editor is part of a plugin that does much more, and some bot controls are paid
A dedicated plugin A quick start Another plugin to keep updated, and it may refuse to work beside a physical file

Route 1: a physical file

Create a file named robots.txt, paste your rules and upload it to the document root of your public site: the folder your home page is served from. That is usually the folder holding wp-config.php, but if WordPress lives in a sub-folder and serves the site from the root, it goes beside the index.php that loads WordPress. Open https://your-domain/robots.txt afterwards to check.

Route 2: an SEO plugin

Yoast SEO's help page says its editor is under Yoast SEO, Tools, File Editor, and that the menu does not appear if file editing is disabled on your install. When you create a file there, Yoast says it replaces the WordPress default with its own block. Yoast SEO's wordpress.org listing, version 28.8, last updated 27 October 2026 as read today, says a bot blocker for AI training crawlers, including GPTBot, CCBot and Google-Extended, is a Premium feature. Other SEO plugins offer similar editors.

Route 3: a dedicated plugin

Block AI Crawlers, version 1.6.3, last updated 1 November 2026 as read today, with 2,000 or more active installations, adds rules that tell AI companies not to crawl through robots.txt. Its listing says each crawler has its own toggle under Settings, Block AI Crawlers, and that it only works with the built-in virtual file. If a physical file exists, you cannot activate it. A plugin that blocks a long list may also block an AI search bot you wanted. These are examples, not recommendations: read a plugin's listing and recent changes first.

For developers: the robots_txt filter

The filter keeps the rules in code and works with the virtual file. Add this to a small plugin or your child theme's functions.php:

add_filter( 'robots_txt', function ( $output, $public ) {
    $ai_rules  = "User-agent: GPTBot\nDisallow: /\n\n";
    $ai_rules .= "User-agent: ClaudeBot\nDisallow: /\n\n";
    $ai_rules .= "User-agent: CCBot\nDisallow: /\n\n";
    return $ai_rules . $output;
}, 10, 2 );

It puts the AI rules in front of what WordPress or a plugin already produced. Group order does not matter to a crawler.

Check each token against the operator's documentation. OpenAI lists GPTBot for training and OAI-SearchBot for ChatGPT search. Anthropic lists ClaudeBot, Claude-SearchBot and Claude-User. Perplexity lists PerplexityBot. Common Crawl documents CCBot.

# Training and model-use controls
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: Applebot-Extended
Disallow: /

# AI search crawlers
User-agent: OAI-SearchBot
Allow: /

User-agent: Claude-SearchBot
Allow: /

User-agent: PerplexityBot
Allow: /

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

Google-Extended and Applebot-Extended are controls in robots.txt, not separate crawlers. Google says Google-Extended has no user agent string of its own, and Apple says Applebot-Extended does not crawl. See what Google-Extended costs you.

Fetchers that act for a person are different: OpenAI says robots.txt rules "may not apply" to ChatGPT-User. See robots.txt and AI bots for what the file can do, and should you block AI crawlers for the choice.

Check what else may be blocking bots

Three other places can stop a bot before it reads your rules.

  • A security plugin. Some plugins block traffic by user agent or rate. Check its firewall or bot settings for rules that name AI bots.
  • Your host. Check the control panel for a bot or firewall setting, or ask support.
  • A CDN. If your site uses Cloudflare, read Is Cloudflare blocking AI crawlers on your site.

If your server is nginx or Apache, how to block AI crawlers in nginx and Apache shows rules that work outside WordPress.

Test the result

  1. Open https://example.com/robots.txt in a browser, with your own domain, and read it from top to bottom.
  2. Check that your rules are there and that no lines from a plugin or CDN contradict them.
  3. Run a bot user agent through curl:
curl -s -o /dev/null -w "%{http_code}\n" -A "GPTBot" https://example.com/
curl -s -o /dev/null -w "%{http_code}\n" -A "OAI-SearchBot" https://example.com/

A 200 for both means nothing blocks them at the server. A 403 or a challenge page means a firewall, plugin or CDN rule matches the name. robots.txt itself returns 200 and lets the bot decide.

  1. Wait. Perplexity says changes may take up to 24 hours to take effect, and Meta says crawlers may cache robots.txt for up to 24 hours. A page cache or CDN may also hold the old file, so clear it.

The curl test sends only a name, so the real bot may get a different answer (why).

How Lundot handles this

Lundot does not change your WordPress robots.txt. The free AI crawler check reads your live file for each bot token, whichever route produced it. To see which bots request your pages, verified, connect Cloudflare (Connect Cloudflare, AI bots report). The tracking script goes in the WordPress header, but AI crawlers do not run scripts, so it cannot see them.

Sources

Put it into practice

  • DocsConnect Cloudflare

    Record verified AI bot requests at Cloudflare: what is added, what access is asked for, how it is checked.

  • DocsAI bots

    Verified AI crawler, assistant and agent requests, per page and company.

  • ProductSee which AI bots request your pages, verified

    Lundot records AI crawler, assistant and agent requests at Cloudflare, per page and company, and shows how each was verified. Unverified claims never count.

See what your robots.txt tells AI crawlers

The AI crawler check is free and needs no account. It reads your robots.txt for each AI crawler, checks whether your home page has text without JavaScript, and looks for llms.txt.