Skip to content

Instantly share code, notes, and snippets.

@KaineLabs
Last active July 2, 2020 05:31
Show Gist options
  • Save KaineLabs/577d094c67e585729da12cdddde9ffb8 to your computer and use it in GitHub Desktop.
Save KaineLabs/577d094c67e585729da12cdddde9ffb8 to your computer and use it in GitHub Desktop.
Redirect "wp-login.php" Page To Youzer Login Page
<?php
/**
* Redirect "wp-login.php" Page To Youzer Login Page.
*/
function yz_redirect_wplogin_to_youzer_login_page() {
if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'logout' || $_GET['action'] == 'lostpassword' || $_GET['action'] == 'rp' || $_GET['action'] == 'bp-resend-activation' ) ) {
return;
}
global $pagenow;
if ( 'wp-login.php' == $pagenow && $_SERVER['REQUEST_METHOD'] == 'GET' ) {
// Get Login Page Url.
$login_url = 'add-your-custom-login-page-url-here';
// Redirect !!
wp_redirect( $login_url );
exit();
}
}
add_action( 'init', 'yz_redirect_wplogin_to_youzer_login_page' );
@zaheera5699
Copy link

Hi,
Sir, i have create a new one "bp-custom.php" in the path "wp-content/plugins" and add this code. But does not redirect the URL "https://offermom.com/wp-login.php" to https://offermom.com/login/

Screenshoot: http://prnt.sc/sx6lvt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment