Redirect Default Login Page Wordpress

How to Redirect Default Login Page on WordPress













Have you ever visited a website and been impressed by its unique and customized login page? You know, the ones that make you feel like you’re entering a secret club or exclusive members-only area? Well, if you own a WordPress site and want to give your visitors that same wow factor, then you’re in luck. In this blog post, I am going to show you exactly how to redirect the default login page on WordPress to a custom login page that is as unique as your brand. When it comes to creating a cohesive and branded online experience, every little detail counts. And let’s be honest, the default WordPress login page doesn’t exactly scream “professional” or “memorable.” That’s where redirecting the login page comes in. By redirecting the default login page to a custom one, you can elevate your website’s design and user experience to a whole new level. But how exactly do you go about redirecting the default login page on WordPress? Don’t worry, I’ve got you covered. In this step-by-step guide, we’ll walk you through the process of redirecting the login page using a simple yet powerful plugin.

Why Redirecting the Default Login Page is Important

Redirecting the default login page on WordPress is an essential step towards ensuring the security and user experience of your website. If the default login page is active on your site, it becomes easier for malicious actors to target your site and brute force to gain unauthorized access. Brute force attacks involve automated bots attempting to guess the username and password combinations to gain access to the site. By redirecting the login page, you can make it harder for these bots to continually target the same URL, thus reducing the risk of successful attacks.

The default login page on WordPress is usually accessed by adding “/wp-admin” or “/wp-login.php” to the end of your site’s URL. This makes it easy for hackers and bots to find and target this page. By redirecting the default login page to a different URL, you can make it more difficult for unauthorized users to locate the login page and attempt to break into your website.

Redirecting the default login page also allows you to have full control over the login process. You can create a unique and branded login page that matches the overall design and aesthetic of your website. This not only provides a cohesive user experience but also helps to build trust and credibility with your users. With a customized login page, you can include additional security measures such as two-factor authentication or reCAPTCHA to further fortify the login process.

There are several methods to redirect the default login page on WordPress. One common approach is through the use of plugins. Popular security plugins like Wordfence, iThemes Security, or All In One WP Security & Firewall offer features that allow you to easily redirect the login page. However, I do not want you to install a specific security plugin to redirect the default login page for this little feature. In this guide, I will share you the best way to implement redirection for the default login page of your site.

Setting Up the Redirection

When it comes to redirecting the default login page on WordPress, choosing the right plugin is crucial. With the abundance of options available, it can be overwhelming to find the perfect plugin for your needs. Moreover, the plugin may come with additional set of features which you may not need at all or cause conflict with other plugins on your site.

First and foremost, compatibility is essential. In this guide, I will show a solution that works seamlessly with your website and doesn’t cause any compatibility issues or conflicts with other plugins or themes by adding custom code.

  1. To begin, you need to install the plugin WPCode. WPCode, in my experience, is the best plugin to add custom codes to your WordPress site. Whether it is PHP code, Javascript code or even HTML / CSS codes, you won’t go wrong with WPCode.
  2. Once the WPCode plugin is installed and activated, navigate to “Code Snippets” and click on “Add New” button.
  3. From there, click on the link “blank snippet and create your own”.
  4. On the next page, give a title to the snippet, such as “Login redirect”.
  5. For the Code Type, select “PHP Snippet”.
  6. On the Code Preview box, paste the following code:
function custom_login_page() {
 $new_login_page_url = home_url('custom-page'); // new login page
 global $pagenow;
 if( $pagenow == "wp-login.php" && $_SERVER['REQUEST_METHOD'] == 'GET') {

  1. In the above code, replace “custom-page” with the permalink part of the page to which you want to redirect the default login URL.
  2. Scroll down to the “Insertion” section and set “Insert Method” to “Auto-Insert”.
  3. For Location, select “Frontend Only”
  4. Then click on “Save Snippet” button and make sure it is set as “Active”.

Here’s a screenshot of how the snippet and its settings should look once you follow through above steps:

redirect login page wordpress

Testing the Redirected Login Page

Testing the redirected login page helps you identify any potential issues or errors that may arise during the login process. It allows you to verify if the redirection is working as intended and if the customized login page is rendering correctly across different devices and browsers.

For testing, I recommend using private browser tab on incognito mode. Visit the following URLs and verify if the site gets redirected to the URL specified in the code:


Additionally, you should test various scenarios, such as entering invalid credentials, forgotten password recovery, and successful login attempts.

Furthermore, it is crucial to assess the performance of the redirection to login page. The page should load quickly, ensuring a smooth and seamless user experience. Slow loading times could be an indication of conflict with another setting on your site.


WordPress is customizable in many ways with little snippets of codes here and there. I hope you found this little guide helpful to redirect the default login page on your WordPress. As always, if you run into any troubles, feel free to comment down below to let know and I’ll do my best to assist you!

Leave a Reply

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