This required Yoast SEO to be installed on your WordPress install.

Whilst in the loop:


if ( WPSEO_Meta::get_value( 'meta-robots-noindex', $postid ) === '1' ) {
		//$robots['index'] = 'noindex';
		$index = "no";
		echo 'No Index';
		}

if ( WPSEO_Meta::get_value( 'meta-robots-nofollow', $postid ) === '1' ) {
		//$robots['follow'] = 'nofollow';
		$follow = "no";
		echo 'No Follow';
		}

Leave a Reply