rmarcano
4/11/2018 - 2:33 PM

Add noindex tag to posts that match a condition

This snippet uses the wpseo_robots filter to add a "noindex, follow" to posts that match a certain condition (in this example, is_single()).

add_filter( 'wpseo_robots', function ( $robots ) {
  if ( is_single() ) {
    return 'noindex,follow';
  }
  return $robots;
});