• Fleuv

    (@fleuv)


    Hi there,

    I tried to avoid the use of wp-login by adding a login form to a page on my site and by adding this code to my theme it’s functions.php

    //REMOVE or DISABLE WP-LOGIN
    function remove_wplogin() {
    	global $pagenow;
    
    	if ( 'wp-login.php' == $pagenow ) {
    		wp_redirect(get_page_link(218));
    		exit;
    	}
    }
    add_action( 'init', 'remove_wplogin' );

    This code redirects all incoming traffic to wp-login.php to my new login page what got the page id 218.

    Bugs occurred..
    First of all logging out isn’t possible any more because the function wp_logout_url() uses wp-login.php by default (same for logging in). All other default redirects like this one, go to: ../wp-admin without being logged in as admin, this will redirect back to wp-login.php (I might be wrong about this)

    Does someone know how to fix this or is it not possible to change (without modifying wordpress core)

Viewing 2 replies - 1 through 2 (of 2 total)
  • Rod Whiteley

    (@rod-whiteley)

    wp_logout_url() applies logout_url filters so that you can change the URL. wp_login_url() does the same kind of thing.

    Thread Starter Fleuv

    (@fleuv)

    By filtering logout_url you’ll be able to change the URL. But not every custom URL has a statement or something, scripted on custom.php?action=logout

    I’ve found out how to change it but I decided to leave it behind, but perhaps I’ll comeback later on it.

    This answer is explaining what I’m trying to say. Only I don’t know if it works correctly

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Avoiding the use of wp-login.php’ is closed to new replies.