How to change the URL of login page in WordPress?

I'm trying to find a way to change my WordPress website's login page URL, any easy way to do it?


  • 1. Add the following code to wp-config.php:

    define('WP_ADMIN_DIR', 'admin-path');

    2. Add the following code to functions.php:

    add_filter('site_url', 'wpadmin_filter', 10, 3);
     function wpadmin_filter ( $url, $path, $orig_scheme ) {
     $old = array( "/(wp-admin)/");
     $admin_dir = WP_ADMIN_DIR;
     $new = array($admin_dir);
     return preg_replace( $old, $new, $url, 1);

    3. Add the following code to htaccess:

     RewriteRule ^admin-path/(.*) wp-admin/$1?%{QUERY_STRING} [L]

    Or alternatively, you can go to Plugins > Add new and add the WPS Hide Login ( plugin to change the admin URL

Sign In or Register to comment.