WordPress.org

Make WordPress Core

Changeset 19304


Ignore:
Timestamp:
11/15/2011 08:44:48 PM (7 years ago)
Author:
ryan
Message:

Introduce wp_no_robots(). Call it for pages that should never be indexed, regardless of blog privacy settings. Props nacin. fixes #19251

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/options-writing.php

    r19119 r19304  
    158158<h3><?php _e('Update Services') ?></h3>
    159159
    160 <?php if ( get_option('blog_public') ) : ?>
     160<?php if ( 1 == get_option('blog_public') ) : ?>
    161161
    162162<p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="http://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p>
  • trunk/wp-includes/default-filters.php

    r18932 r19304  
    220220
    221221if ( isset( $_GET['replytocom'] ) )
    222     add_filter( 'pre_option_blog_public', '__return_zero' );
     222    add_action( 'wp_head', 'wp_no_robots' );
    223223
    224224// Login actions
  • trunk/wp-includes/functions.php

    r19297 r19304  
    18501850    $output = "User-agent: *\n";
    18511851    $public = get_option( 'blog_public' );
    1852     if ( '0' ==  $public ) {
     1852    if ( '0' == $public ) {
    18531853        $output .= "Disallow: /\n";
    18541854    } else {
  • trunk/wp-includes/general-template.php

    r19282 r19304  
    16781678 *
    16791679 * If a blog is marked as not being public then the noindex meta tag will be
    1680  * output to tell web robots not to index the page content.
     1680 * output to tell web robots not to index the page content. Add this to the wp_head action.
     1681 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'noindex' );
     1682 *
     1683 * @see wp_no_robots
    16811684 *
    16821685 * @since 2.1.0
     
    16851688    // If the blog is not public, tell robots to go away.
    16861689    if ( '0' == get_option('blog_public') )
    1687         echo "<meta name='robots' content='noindex,nofollow' />\n";
     1690        wp_no_robots();
     1691}
     1692
     1693/**
     1694 * Display a noindex meta tag.
     1695 *
     1696 * Outputs a noindex meta tag that tells web robots not to index the page content.
     1697 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_no_robots' );
     1698 *
     1699 * @since 3.3.0
     1700 */
     1701function wp_no_robots() {
     1702    echo "<meta name='robots' content='noindex,nofollow' />\n";
    16881703}
    16891704
  • trunk/wp-login.php

    r19281 r19304  
    4343
    4444    // Don't index any of these forms
    45     add_filter( 'pre_option_blog_public', '__return_zero' );
    46     add_action( 'login_head', 'noindex' );
     45    add_action( 'login_head', 'wp_no_robots' );
    4746
    4847    if ( empty($wp_error) )
  • trunk/wp-signup.php

    r18504 r19304  
    44require( dirname(__FILE__) . '/wp-load.php' );
    55
    6 add_action( 'wp_head', 'signuppageheaders' ) ;
     6add_action( 'wp_head', 'wp_no_robots' );
    77
    88require( './wp-blog-header.php' );
     
    1717}
    1818add_action( 'wp_head', 'do_signup_header' );
    19 
    20 function signuppageheaders() {
    21     echo "<meta name='robots' content='noindex,nofollow' />\n";
    22 }
    2319
    2420if ( !is_multisite() ) {
Note: See TracChangeset for help on using the changeset viewer.