Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created January 20, 2021 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djrmom/4ece0af74a2a6cdfbcc1af73550e9b27 to your computer and use it in GitHub Desktop.
Save djrmom/4ece0af74a2a6cdfbcc1af73550e9b27 to your computer and use it in GitHub Desktop.
facetwp yoast seo filter robots
<?php
/** basic check to modify robots when facets are selected during pre-load **/
add_filter( 'wpseo_robots_array', function( $robots, $class ) {
if ( function_exists( 'FWP' ) && !empty( FWP()->ajax->url_vars ) ) {
$robots['index'] = 'noindex';
$robots['follow'] = 'nofollow';
}
return $robots;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment