-
Notifications
You must be signed in to change notification settings - Fork 357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed always redirect to login page #2971
Fixed always redirect to login page #2971
Conversation
* BUG FIX: Fixed an issue where the redirect would always redirect to the login page. The issue here was we were ommitting the redirect value entirely from the $login_form_array which would then default to setting a $redirect_to value of the REQUEST URI and it would always redirect to that URL based on the wp_login_form defaults when that parameter was missing. This fix, fixes issues for custom redirects (snippets) as well as the Member Homepages Add On.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the WP developer docs, the redirect
argument should always be a string:
https://developer.wordpress.org/reference/functions/wp_login_form/
In the wp_login_form()
function itself, it is clear that redirect
is expected to be a string as well, so passing false
may throw warnings in recent versions of PHP:
https://github.com/WordPress/wordpress-develop/blob/a2bb04fc352f0b58a822ff83f3bd8ca6fed11757/src/wp-includes/general-template.php#L627
Is there a better "default" redirect argument that we can pass here?
* Pass a blank string instead of false as the esc_url will return an empty string if that is passed in. https://github.com/WordPress/wordpress-develop/blob/a2bb04fc352f0b58a822ff83f3bd8ca6fed11757/src/wp-includes/general-template.php#L627 See docs here for more information on esc_url - https://developer.wordpress.org/reference/functions/esc_url/
I moved over to passing an empty string instead of false. This will still work with the I've also removed the |
Added blocking next release tag back to this as it's interfering with Member Homepages and a bunch of custom code that redirects members to specific pages on login. |
The issue here was we were ommitting the redirect value entirely from the $login_form_array which would then default to setting a $redirect_to value of the REQUEST URI and it would always redirect to that URL based on the wp_login_form defaults when that parameter was missing.
This fix, fixes issues for custom redirects (snippets) as well as the Member Homepages Add On.
Setting the
redirect
argument to false by default as Paid Memberships Pro handles it's own redirects during the login process and this returns the expected functionality.All Submissions: