Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Created September 19, 2020 22:39
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 KaineLabs/066ca62d2cb600a260cf9dc20058d986 to your computer and use it in GitHub Desktop.
Save KaineLabs/066ca62d2cb600a260cf9dc20058d986 to your computer and use it in GitHub Desktop.
Set Default BuddyPress Members Directory Scope
<?php
/**
* Set Default BuddyPress Members Directory Scope.
*/
function yz_set_default_members_directory_scope() {
if ( ! bp_is_members_directory() ) {
return ;
}
// Default scope
$scope = 'all';
setcookie( 'bp-members-scope', $scope, null, '/' );
$_COOKIE['bp-members-scope'] = $scope;
}
add_action( 'bp_template_redirect', 'yz_set_default_members_directory_scope' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment