From 44029b1ef10da2ecef05d6283b8c2baa63f9a5a1 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 29 Sep 2011 21:47:04 +0000 Subject: [PATCH] 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 --- wp-includes/functions.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index aaa5cc45cc..dc9a66157d 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -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);