WordPress.org

Make WordPress Core

Ticket #14069: 14069.2.patch

File 14069.2.patch, 978 bytes (added by hakre, 7 years ago)
  • wp-includes/functions.php

     
    18001800 * @uses do_action() Calls 'do_robotstxt' hook for displaying robot.txt rules.
    18011801 */
    18021802function do_robots() {
    1803         header( 'Content-Type: text/plain; charset=utf-8' );
     1803        header( 'Content-Type: text/plain; charset=US-ASCII' );
    18041804
    18051805        do_action( 'do_robotstxt' );
    18061806
    1807         $output = '';
    1808         $public = get_option( 'blog_public' );
    1809         if ( '0' ==  $public ) {
    1810                 $output .= "User-agent: *\n";
    1811                 $output .= "Disallow: /\n";
    1812         } else {
    1813                 $output .= "User-agent: *\n";
    1814                 $output .= "Disallow:\n";
    1815         }
     1807        $blog_public = get_option( 'blog_public' );
     1808        $disallow_path = $blog_public ? '' : ' /';
     1809        $output = "User-agent: *\nDisallow:{$disallow_path}\n";
    18161810
    1817         echo apply_filters('robots_txt', $output, $public);
     1811        echo apply_filters('robots_txt', $output, $blog_public);
    18181812}
    18191813
    18201814/**