WordPressとAIクローラー
WordPressはWeb全体の43%以上のサイトで使われており、AIクローラーの主要なターゲットとなっています。ブログ・メディア・ECサイトなど多様なコンテンツがGPTBotやClaudeBotに読まれています。
方法① robots.txtで設定(推奨)
WordPressの場合、wp-content/uploads/以下のrobots.txtや、プラグインを使ってrobots.txtを編集します。
User-agent: GPTBot
Disallow: /
User-agent: ClaudeBot
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: Bytespider
Disallow: /
Yoast SEOを使っている場合は、SEO → ツール → ファイルエディターからrobots.txtを編集できます。
方法② .htaccessでブロック(Apache)
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} GPTBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ClaudeBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} PerplexityBot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Google-Extended [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Bytespider [NC]
RewriteRule .* - [F,L]
方法③ functions.phpにコードを追加
// functions.php
add_action('init', function() {
$user_agent = $_SERVER['HTTP_USER_AGENT'] ?? '';
$ai_bots = ['GPTBot', 'ClaudeBot', 'PerplexityBot', 'Google-Extended'];
foreach ($ai_bots as $bot) {
if (stripos($user_agent, $bot) !== false) {
status_header(403);
exit('Forbidden');
}
}
});
方法④ プラグインを使う
「AI Block」「Bot Blocker」などのWordPressプラグインが登場しています。管理画面から設定できるため、コーディング不要でブロックできます。
AI Access Monitorでの計測
WordPressサイトへのAIアクセスをリアルタイム計測するには、AI Access Monitorのscriptタグをfunctions.phpやテーマのheader.phpに追加するだけです。