Make WordPress Core


Ignore:
Timestamp:
11/15/2011 08:44:48 PM (13 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.