Skip to content

Instantly share code, notes, and snippets.

@rmarcano
Created April 11, 2018 14:33
Show Gist options
  • Save rmarcano/73d1abbf68d58ff0c0a1ddd2e5916b2c to your computer and use it in GitHub Desktop.
Save rmarcano/73d1abbf68d58ff0c0a1ddd2e5916b2c to your computer and use it in GitHub Desktop.
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;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment