Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




noindex [ ]

noindex ( No parameters )
See:
Defined at:
Codex



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. Add this to the wp_head action. Typical usage is as a wp_head callback. add_action( 'wp_head', 'noindex' );

Source

function noindex() {
	$public = get_option( 'blog_public' );

	if ( is_multisite() ) {
		// Compare local and global and override with the local setting if they
		// don't match.

		global $current_blog;

		if ( ( '' != $public ) && ( $public != $current_blog->public ) ) {
			update_blog_status( get_current_blog_id(), 'public', $public );
			$current_blog->public = $public;
		}
	}

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

Examples [ wp-snippets.com ]

Top Google Search Results

More ...

0 User Note(s)

None yet. Be the first!

Add New ...