Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NigelRodgers/2905d8a4376f1667a3db6e41ebf627d0 to your computer and use it in GitHub Desktop.
Save NigelRodgers/2905d8a4376f1667a3db6e41ebf627d0 to your computer and use it in GitHub Desktop.
Set bbPress User Profile Robots Meta With Rank Math
/**
* Sets bbPress user profile pages to noindex
*
* @param array $robots The meta robots directives.
*/
add_filter( 'rank_math/frontend/robots', function( $robots ) {
if (!bbp_is_single_user_profile()) {
return $robots;
}
unset( $robots['index']);
$robots['index'] = 'noindex';
return $robots;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment