How To Redirect From wp-admin With Hide Login (Hook)

LoginPress provides a way to change your WordPress site’s default login URL to hide your /wp-admin and /wp-login-php; that is a neat trick to outsmart hackers and prevent brute-force attacks on your WordPress site.

In this knowledgebase article, we’ll show you how you can rename the login plugin and redirect from wp-admin to any other page of your choice with the Hide Login (Hook).

Note: We assume that you’ve already Upgraded to LoginPress Pro. If not, you can check out our guide on How To Install And Activate LoginPress PRO Version.

Let’s get started!

Rename the Login Slug with the LoginPress Hide Login Add-on

LoginPress has an Add-on Hide Login that lets you change the Login slug of your default login page, i.e., wp-loginp.php.

Once you’ve installed and activated the Hide Login Add-on, go to the left side of the admin dashboard.  

Next, navigate to LoginPress on the left sidebar of the admin dashboard and click on Settings options


You will move to the Settings screen, where you’ll find the Hide Login tab next to the Settings tab.

Hide Login Tab

Rename the slug from the Rename Login Slug field. You can either go with renaming the login slug on your own or can generate a random login slug by clicking Generate Slug (Randomly)

Note: Here, we’ve used a random Login Slug.

New Login Page URL

Once you’ve renamed your login slug, click Save Changes, which will set your login page slug to a custom slug. 

New Login Page URL

When you are logged out and try to access the login page with /wp-login.php or /wp-admin slug, you’ll get a 404 page

404 Error for the Default Login Page URL

Note: Kindly change the Login Slug carefully. As it can result in loosing the login page slug to login into the site.

Redirect From wp-admin with the Hide Login (Hook)

Once you’ve hidden the Login URL with LoginPress Hide Login Add-on, whosoever tries to access your wp-admin will be redirected to the 404 page by default. 

You can redirect the user to another page of your choice. But you’ll need some coding to make it go.

Here are the steps you need to follow to hide wp-admin and redirect the users to the desired pages:

 Redirecting the User to Some other Pages

Suppose you want to redirect the user to another page (like a login page with a different login URL like "" instead of ""). The following filter will help you to redirect from wp-admin with the Hide Login.

 * The function to redirect the page request if wp-admin is triggered.
 * Add the URL accordingly.
function loginpress_wp_admin_redirect_callback() {
    wp_safe_redirect( 'http://loginpress.local/product-category/accessories/' );
add_filter( 'loginpress_hidelogin_wp_admin_redirect', 'loginpress_wp_admin_redirect_callback' );

Once you’ve added the following code in the child theme’s fonctions.php file, the user will be redirected to “product-category/accessories/” instead of going to the 404 page, as mentioned in the code.

Redirect URL

Note: You can change the wp_safe_redirect( ) to any page URL where you want to redirect your user. 

That’s all! See how easy it is to redirect a user from wp-admin to another login page/s using the above filter. 

If you have any doubts or questions related to this matter, please don’t hesitate to contact our support team.

Still stuck? How can we help?

Updated on November 30, 2022

LoginPress Support
triangular shape yellowish icon

Frequently Asked Questions (FAQs)

These FAQs answer the most common questions about our WordPress custom login page plugin.

three shapes icon

Is LoginPress WPML Compatible?

LoginPress is fully supported with multilingual. LoginPress is also compatible with WPML Plugin, which means you can easily translate your login page with WPML plugin according to the given translation options in the WPML plugin.

Is LoginPress translation ready?

Yes, LoginPress has full translation and localization support via the LoginPress textdomain. All .mo and .po translation files should go into the languages folder in the base of the plugin.

Is coding skills needed to use LoginPress?

No, It is very easy to setup. Just plug and play. Have fun!

How to Install or Use LoginPress Pro?

Step-by-step instructions on How to Upgrade from existing Free version to Pro
1. You have installed and set up the Free version already.
2. Upload the Pro version.
3. Pro features will be enabled automatically.
4. You don’t need to set up Free version options again.
5. Setup Pro features like Google fonts, Google reCaptcha, Choose themes, etc.

Where is my license key?

License key is the Order ID which looks like in this format.
You can find it in the email Sales Receipt.

three shapes icon

If you Still have Questions?

Get In Touch