Disallow indexing wp-admin and wp-includes in robots.txt. Props SergeyBiryukov. fixes #18465

git-svn-id: http://svn.automattic.com/wordpress/trunk@18822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2011-09-29 21:47:04 +00:00
parent 2edc82cd61
commit 44029b1ef1
1 changed files with 5 additions and 4 deletions

View File

@ -1846,14 +1846,15 @@ function do_robots() {
do_action( 'do_robotstxt' );
$output = '';
$output = "User-agent: *\n";
$public = get_option( 'blog_public' );
if ( '0' == $public ) {
$output .= "User-agent: *\n";
$output .= "Disallow: /\n";
} else {
$output .= "User-agent: *\n";
$output .= "Disallow:\n";
$site_url = parse_url( site_url() );
$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
$output .= "Disallow: $path/wp-admin/\n";
$output .= "Disallow: $path/wp-includes/\n";
}
echo apply_filters('robots_txt', $output, $public);