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.

All you need to do is to paste the following code in your website theme's functions.php file.

Note: It’s recommended to use a child theme to edit the functions.php file instead of the parent theme. There are chances to lose the modified code when you update your theme. It might cause some adverse effects on your website.

 * 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 website 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 January 16, 2024

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

Where can I get support for LoginPress?

If you need help with LoginPress, you can contact us here. We’ll be happy to answer any questions about the plugin.

Do you have an affiliate program?

Yes, we have an affiliate program that you can sign up for here. As an affiliate, you’ll earn a commission on every sale you refer to us.

Do you offer refunds?

Yes, we offer a 14-day money-back guarantee on all of our plans. If you’re unsatisfied with LoginPress, simply contact us within 14 days of your purchase, and we’ll process a refund.

Can I upgrade my license after my initial purchase?

Yes, you can upgrade your LoginPress license at any time. Simply log into your account and go to the My Downloads page. From here, you can upgrade your license and download the latest version of the plugin.

Will LoginPress slow down my website?

No, LoginPress will not slow down your website. The plugin is lightweight and only loads the necessary files when someone tries to access your login page.

three shapes icon

If you Still have Questions?

Get In Touch