Warning: This function has been deprecated. Use wp_robots_no_robots() instead on ‘wp_robots’ filter.

wp_no_robots() WordPress Function

The wp_no_robots() function is a built-in function used to prevent search engines from indexing a page or post. It is typically used on pages that contain sensitive or confidential information. When used on a page or post, the wp_no_robots() function will insert a "noindex" meta tag into the page's source code. This meta tag tells search engines not to index the page.

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

Top ↑

Source

File: wp-includes/deprecated.php

function wp_no_robots() {
	_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' );

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

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


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Use wp_robots_no_robots() instead on 'wp_robots' filter.
5.3.0Echo noindex,nofollow if search engine visibility is discouraged.
3.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More