Created
November 14, 2018 02:10
-
-
Save KaineLabs/43d37835d8c39bcf971e2dfd230757b8 to your computer and use it in GitHub Desktop.
Redirect Members Directory To Login Page For Non Logged in Users.
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 | |
/** | |
* Redirect Members Directory To Login Page For Non Logged in Users. | |
*/ | |
function yzc_redirect_members_directory_to_login_page() { | |
if ( ! is_user_logged_in() && bp_is_members_directory() ) { | |
$redirect_url = yz_get_login_page_url(); | |
wp_redirect( $redirect_url ); | |
exit(); | |
} | |
} | |
add_action( 'template_redirect', 'yzc_redirect_members_directory_to_login_page' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment