How To Change WordPress Login Page Url

How To Articles

Changing the login page URL for WordPress is a great way to enhance the security of your website. By default, the login page URL for WordPress is usually set as “/wp-login.php”. This default URL makes it easier for hackers to target your website and attempt unauthorized login attempts.

In this article, I will guide you through the process of changing the WordPress login page URL to something more unique and personalized. Before we proceed, I want to emphasize the importance of taking regular backups of your website. Modifying core files can sometimes lead to unexpected issues, so it’s always better to be safe than sorry.

To get started, you need to have access to your website’s files through FTP or cPanel’s File Manager. Once you have access, follow the steps below:

Step 1: Choose a New Login Page URL

The first step is to decide on a new login page URL that is easy for you to remember but difficult for others to guess. It’s important to avoid using common names or terms related to your website, as these can still be vulnerable to brute-force attacks.

For example, instead of using “/wp-login.php”, you can choose something like “/my-secret-login” or “/hidden-door”. The key is to make it unique and unpredictable.

Step 2: Update the Functions.php File

Once you have chosen a new login page URL, you need to update the functions.php file of your WordPress theme. This file contains the code responsible for handling various functions on your website.

Open the functions.php file using a text editor and add the following code at the end of the file:

function custom_login_page() {
global $pagenow;

if ( $pagenow === 'wp-login.php' ) {
wp_redirect( '/your-new-login-page-url' );
add_action( 'init', 'custom_login_page' );

Replace “/your-new-login-page-url” with the URL you have chosen in Step 1.

Step 3: Save and Upload the Updated File

After adding the code to the functions.php file, save the file and upload it back to your website using FTP or cPanel’s File Manager. Make sure to overwrite the existing file.

Step 4: Test the New Login Page URL

Once the updated functions.php file is uploaded, it’s time to test the new login page URL. Open a new browser tab and enter your website’s URL followed by the new login page URL you have chosen.

For example, if your website’s URL is “” and the new login page URL is “/my-secret-login”, you would enter “” in the browser’s address bar.

If everything is set up correctly, you should be redirected to the new login page. Try logging in with your WordPress credentials to ensure that the login process is working as expected.


Changing the login page URL is a simple yet effective way to enhance the security of your WordPress website. By making it more difficult for hackers to find your login page, you can significantly reduce the risk of unauthorized access.

Remember to choose a unique and unpredictable login page URL, update the functions.php file with the necessary code, and test the new login page to ensure everything is working smoothly. And, as always, don’t forget to take regular backups of your website to be on the safe side.

By following these steps, you can strengthen the security of your WordPress login page and provide an extra layer of protection for your valuable website content.