wordpressは「設定」→「表示設定」の中にある「検索エンジンでの表示」の項目でクロール許可、ブロックが選択できます。
[検索エンジンがサイトをインデックスできないようにする]
※古いバージョンのwordpressでは「設定」→「プライバシー」の中にある「サイトの表示状態」で選択。
この選択によって生成される仮想robots.txtの内容が変わります。
robots.txt を生成している関数は /wp-includes/functions.php になります。
インデックスを許可した場合(wordpress 3.3以降)
User-agent: *
Disallow: {WordPressの設置ディレクトリ}/wp-admin/
Disallow: {WordPressの設置ディレクトリ}/wp-includes/
インデックスを許可しない場合(wordpress 3.3以降)
User-agent: *
Disallow: /
インデックスを許可する場合でも、wp-adminやwp-includesフォルダへのアクセスは禁止しています。
wordpress 3.2以前のrobots.txtはインデックスを許可する場合はすべてのファイル許可となるので
上記のようにwp-adminやwp-includeフォルダをブロックしたい場合はテーマのfunctions.phpに
以下を記述します。
<?php
function lf_custom_robots_txt($output) {
$wp_version = get_bloginfo( 'version' );
$public = get_option( 'blog_public' );
if ( '0' != $public ) { // open
$site_url = parse_url( site_url() );
$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
if ( version_compare( $wp_version, '3.3', '<') ) {
$output = str_replace( "Disallow:\n", "", $output );
$output .= "Disallow: $path/wp-admin/\n";
$output .= "Disallow: $path/wp-includes/\n";
}
}
return $output;
}
add_filter('robots_txt', 'lf_custom_robots_txt');
?>