Warning: This function has been deprecated. Use wp_no_robots() instead.

noindex() WordPress Function

The noindex() function is a WordPress function that is used to prevent a post or page from being indexed by search engines. This function can be useful if you want to keep a post or page private, or if you want to prevent a post or page from being found in search engine results. The noindex() function can be added to a WordPress theme or plugin, or it can be added to a WordPress post or page.

noindex() #

Displays a noindex meta tag if required by the blog configuration.


Description

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.

Typical usage is as a ‘wp_head’ callback:

add_action( 'wp_head', 'noindex' );

Top ↑

See also


Top ↑

Source

File: wp-includes/deprecated.php

function noindex() {
	_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_noindex()' );

	// If the blog is not public, tell robots to go away.
	if ( '0' == get_option( 'blog_public' ) ) {
		wp_no_robots();
	}
}


Top ↑

Changelog

Changelog
VersionDescription
5.7.0Use wp_robots_noindex() instead on 'wp_robots' filter.
2.1.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