Fixing Broken Admin Links in Emails When Using WPS Hide Login
Content
WPS Hide Login is a popular plugin for changing your WordPress login URL, but a common frustration occurs when other parts of your site continue to generate links using the default wp-admin or wp-login.php paths. This results in broken links in emails for actions like changing your admin email, confirming data erasure requests, or moderating comments.
Why This Happens
The core issue is that WPS Hide Login only changes the login URL. It does not change the admin URL (/wp-admin/). Many WordPress functions and third-party plugins use the admin_url() function to generate links for emails. Since WPS Hide Login does not alter this function's output, these emails will always contain the standard /wp-admin/ path.
Furthermore, some specific confirmation links (like for changing an admin email or confirming a data erasure) are dynamically generated by WordPress core and may not always be compatible with the login URL change, especially if other account or login-related plugins are active.
Common Solutions and Workarounds
1. You Must Be Logged In
For many admin links, such as comment moderation (.../wp-admin/comment.php?action=approve...), the link will work correctly if you are already logged into WordPress. The plugin's 404 redirect for /wp-admin/ is bypassed for logged-in users. If you receive a 404, try logging in first and then clicking the link.
2. Identify Plugin Conflicts
Many reported issues, particularly with email change confirmations and data erasure requests, are caused by conflicts with other plugins. The WPS Hide Login team has stated that their plugin generates the correct links for core WordPress functions. If a link is wrong, it is likely being generated by another plugin.
- Common Culprits: WooCommerce, BuddyPress, AffiliateWP, and other plugins that create custom login or account pages.
- Troubleshooting Steps: Deactivate other plugins one by one and test the email link again. If the link starts working, you've found the conflicting plugin. You will need to contact that plugin's support and ask if they have a filter to make their generated links compatible with login URL changes.
3. Manually Construct Links for Custom Code
If you are a developer and need to use the custom login URL in your own code or email templates, you cannot use the standard admin_url() or wp_login_url() functions.
You can retrieve the custom slug from the plugin's setting and build the URL manually:
$custom_login_slug = get_option( 'whl_page' );
$custom_login_url = site_url( '/' . $custom_login_slug . '/' );
// Example: To get a link to the admin profile page, you must use the standard admin URL.
// The custom slug is only for the login screen.
$admin_profile_url = admin_url( 'profile.php' );
Important Note: Sending the hidden login URL in emails defeats the security purpose of the plugin. This should only be done for trusted admin users.
4. Specific Scenarios
- Changing Admin Email: This is a core WordPress function that should work with WPS Hide Login. If it does not, a plugin conflict is the most probable cause. Test with all other plugins disabled.
- GDPR Data Erasure/Export Links: These links (
.../wp-login.php?action=confirmaction...) should automatically use the new custom login URL. If they do not, ensure you are using the latest version of WPS Hide Login and check for conflicts with other plugins. - Comment Moderation Links: These links point to
/wp-admin/and will only work if you are logged in. There is no built-in way to change this.
Conclusion
Most broken email link issues with WPS Hide Login stem from one of two sources: the inherent behavior of admin links requiring a logged-in session, or a conflict with another plugin that generates its own URLs. The solution involves methodical troubleshooting to identify the conflict or adjusting expectations for how admin links function once the login URL is hidden.
Related Support Threads Support
-
The confirmation link to change to new admin email redirects to 404https://wordpress.org/support/topic/the-confirmation-link-to-change-to-new-admin-email-redirects-to-404/
-
[NSFW] Plugin breaks confirmation email linkhttps://wordpress.org/support/topic/plugin-breaks-confirmation-email-link/
-
Conflict gdpr export/delete linkhttps://wordpress.org/support/topic/conflict-gdpr-export-delete-link/
-
Change Admin Email Not Workinghttps://wordpress.org/support/topic/change-admin-email-not-working/
-
Broken erasure request email linkhttps://wordpress.org/support/topic/broken-erasure-request-email-link/
-
Link for moderation panelhttps://wordpress.org/support/topic/link-for-moderation-panel/
-
$manage_urlhttps://wordpress.org/support/topic/manage_url/
-
Change URL in “please moderate”-emailshttps://wordpress.org/support/topic/change-url-in-please-moderate-emails/
-
Change admin URL through WP-CLIhttps://wordpress.org/support/topic/change-admin-url-through-wp-cli/
-
Comments moderationhttps://wordpress.org/support/topic/comments-moderation-7/
-
Update Admin Emailhttps://wordpress.org/support/topic/update-admin-email-2/
-
Redirect URLs from emailshttps://wordpress.org/support/topic/redirect-urls-from-emails/
-
How to get the new admin URL via a hook or something?https://wordpress.org/support/topic/how-to-get-the-new-admin-url-via-a-hook-or-something/
-
404 on “Erase Personal Data” linkhttps://wordpress.org/support/topic/404-on-erase-personal-data-link/
-
Cannot change admin emailhttps://wordpress.org/support/topic/cannot-change-admin-email-2/