How To Disable WP-Login.php Page on WordPress

Sharing is Caring

Add this function in functions.php

// Disable wp login
function custom_login_page() {
$new_login_page_url = home_url( ‘/login/’ ); // new login page
global $pagenow;
if( $pagenow == “wp-login.php” && $_SERVER[‘REQUEST_METHOD’] == ‘GET’) {
wp_redirect($new_login_page_url);
exit;
}
}
if(!is_user_logged_in()){
add_action(‘init’,’custom_login_page’);
}

Sharing is Caring

Get Premium Content For Free

Just put your email to get exclusive content!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *