Created
September 19, 2020 22:39
-
-
Save KaineLabs/066ca62d2cb600a260cf9dc20058d986 to your computer and use it in GitHub Desktop.
Set Default BuddyPress Members Directory Scope
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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