WordPress.org

Make WordPress Core

Ticket #18465: 18465.5.patch

File 18465.5.patch, 771 bytes (added by SergeyBiryukov, 7 years ago)

Same as previous, but switched to !empty() again

  • wp-includes/functions.php

     
    18441844
    18451845        do_action( 'do_robotstxt' );
    18461846
    1847         $output = '';
     1847        $output = "User-agent: *\n";
    18481848        $public = get_option( 'blog_public' );
    18491849        if ( '0' ==  $public ) {
    1850                 $output .= "User-agent: *\n";
    18511850                $output .= "Disallow: /\n";
    18521851        } else {
    1853                 $output .= "User-agent: *\n";
    1854                 $output .= "Disallow:\n";
     1852                $site_url = parse_url( site_url() );
     1853                $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
     1854                $output .= "Disallow: $path/wp-admin/\n";
     1855                $output .= "Disallow: $path/wp-includes/\n";
    18551856        }
    18561857
    18571858        echo apply_filters('robots_txt', $output, $public);