WordPress.org

Ready to get started?Download WordPress

Forums

Avoiding the use of wp-login.php (3 posts)

  1. Fleuv
    Member
    Posted 9 months ago #

    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)

  2. Rod Whiteley
    Member
    Posted 9 months ago #

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

  3. Fleuv
    Member
    Posted 9 months ago #

    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

Reply

You must log in to post.

About this Topic

Tags

No tags yet.