By default whenever you disable indexing via Admin Settings

[ x ] Discourage search engines from indexing this site

<meta name='robots' content='noindex,follow' />


How do I change that to be nofollow instead of follow? I find it odd it enables "follow" and overall want it noindex,nofollow.

I could echo directly into wp_head but this doesn't account for pages such as wp-login and the likes.

Thought this was a great question so I went digging. In default-filters.php on line 208 there's add_action('wp_head', 'noindex', 1); as of WordPress 4.1. The noindex() function in turn checks to see if you have set blog_public option to 0. If you have, it calls wp_no_robots() which is simply:

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


Neither of last methods are filterable, but a simple plugin will do the trick to remove the hook:

/*
* Declare plugin stuff here
*/



Now, you're free to hook your own action on to echo out what you want.

add_action('wp_head', 'my_no_follow', 1);

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

• You would also want to run it on the wp-login.php header file also, which is excluded from wp_head ( or seems to be ). Looking for blog_public is a good point though to make it more usable. Thanks! – Howdy_McGee Jan 14 '15 at 23:58

I suppose this ended up working for me. I was more hoping for some kind of better filter but it works just as well. Throw this in a functions.php file and you're good to go.

/** No Index No Follow Entire Website **/
function nofollow_meta() {
echo "<meta name='robots' content='noindex,nofollow' />\n";
}