WordPress at a glance

wp_no_robots() WP 1.0

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

No Hooks.

Return

Null. Nothing.

Usage

wp_no_robots();

Changelog

Since 3.3.0 Introduced.
Since 5.3.0 Echo "noindex,nofollow" if search engine visibility is discouraged.

Code of wp no robots: wp-includes/general-template.php WP 5.4.2

<?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";
}
No comments
        Log In . Register