WordPress.org

Make WordPress Core

Ticket #18465: noindex.patch

File noindex.patch, 1.6 KB (added by joostdevalk, 2 years ago)

Noindex HTTP header patch for wp-admin

  • wp-includes/functions.php

     
    11341134        } else { 
    11351135                $site_url = parse_url( site_url() ); 
    11361136                $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : ''; 
    1137                 $output .= "Disallow: $path/wp-admin/\n"; 
    11381137                $output .= "Disallow: $path/wp-includes/\n"; 
    11391138        } 
    11401139 
     
    35283527} 
    35293528 
    35303529/** 
     3530 * Send a HTTP header to prevent indexation of opened URL by search engines that support it. 
     3531 * 
     3532 * @link http://googleblog.blogspot.com/2007/07/robots-exclusion-protocol-now-with-even.html 
     3533 * 
     3534 * @since 3.3.0 
     3535 * @return none 
     3536 */ 
     3537function send_noindex_header() { 
     3538        @header("X-Robots-Tag: noindex"); 
     3539} 
     3540 
     3541/** 
    35313542 * Returns a MySQL expression for selecting the week number based on the start_of_week option. 
    35323543 * 
    35333544 * @internal 
  • wp-admin/admin-ajax.php

     
    1414define('DOING_AJAX', true); 
    1515define('WP_ADMIN', true); 
    1616 
     17send_noindex_header(); 
     18 
    1719if ( ! isset( $_REQUEST['action'] ) ) 
    1820        die('-1'); 
    1921 
  • wp-admin/admin.php

     
    6666auth_redirect(); 
    6767 
    6868nocache_headers(); 
     69send_noindex_header(); 
    6970 
    7071// Schedule trash collection 
    7172if ( !wp_next_scheduled('wp_scheduled_delete') && !defined('WP_INSTALLING') )