wp_no_robots()

Display a noindex meta tag.


Description

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’ );


Source

File: wp-includes/general-template.php

function wp_no_robots() {
	if ( get_option( 'blog_public' ) ) {
		echo "<meta name='robots' content='noindex,follow' />\n";
		return;
	}

	echo "<meta name='robots' content='noindex,nofollow' />\n";
}


Changelog

Changelog
Version Description
WP-5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged.
WP-3.3.0 Introduced.