`wp_redirect('/')` after login breaks WordPress Multisite subdirectory installs
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- php, wordpress
- Domain
- authentication
Research direction
Start with onLogin() and onExchangeFailed() around the referenced redirect calls, then compare them with onLogout(), which already passes the subsite-aware URL. Update the four login and exchange redirect locations so a Multisite subdirectory login stays on the current site, and verify the reproduction redirects to /subsite-a/ rather than the network root.
Written by the indexing model from the issue text.
Description
Checklist
- I have looked into the Readme and the documentation, and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Description
Several code paths hardcode wp_redirect('/') instead of resolving the current site's URL. On a Multisite subdirectory install, an absolute / always resolves to the network's root site, not the subsite the user is actually logging into. onLogout() gets this right (passes get_site_url(), which is subsite-aware) but the login/exchange paths don't.
Reproduction
- Set up WordPress Multisite in subdirectory mode with at least one non-root subsite.
- Configure and activate the plugin network-wide.
- Log in on
example.com/subsite-a/wp-login.php. - Observe the redirect lands on
example.com/(network root) instead ofexample.com/subsite-a/.
Additional context
// onLogin() success, ~539 / error, ~546 / already-authenticated, ~551
wp_redirect('/');
// onExchangeFailed(), ~562
wp_redirect('/');
Related: #935, closed as stale without a confirmed root cause. Suggested fix: use admin_url() or get_site_url() in all four locations, matching onLogout().
wp-auth0 version
5.6.1
WordPress version
7.1
PHP version
8.4
- Dominant language
- PHP
- Stars
- 182
- Forks
- 103
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from auth0/wordpress
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
-
Scope: Documentation
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Roadmap: Backlog
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·