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

git-svn-id: https://develop.svn.wordpress.org/trunk@19304 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2011-11-15 20:44:48 +00:00
parent 11fb1f6b78
commit 80ee709653
6 changed files with 22 additions and 12 deletions
+17 -2
View File
@@ -1677,14 +1677,29 @@ function wlwmanifest_link() {
* Display a noindex meta tag if required by the blog configuration.
*
* If a blog is marked as not being public then the noindex meta tag will be
* output to tell web robots not to index the page content.
* output to tell web robots not to index the page content. Add this to the wp_head action.
* Typical usage is as a wp_head callback. add_action( 'wp_head', 'noindex' );
*
* @see wp_no_robots
*
* @since 2.1.0
*/
function noindex() {
// If the blog is not public, tell robots to go away.
if ( '0' == get_option('blog_public') )
echo "<meta name='robots' content='noindex,nofollow' />\n";
wp_no_robots();
}
/**
* Display a noindex meta tag.
*
* Outputs a noindex meta tag that tells web robots not to index the page content.
* Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_no_robots' );
*
* @since 3.3.0
*/
function wp_no_robots() {
echo "<meta name='robots' content='noindex,nofollow' />\n";
}
/**