This part of code was introduced as whole block, together with a bunch of other stuff, quite a few years ago. See changeset 8069 in trac.
While there is no clear mention in PHP docs, apparently in specific configurations the value might be a full URL with protocol. See for example $_SERVER[‘REQUEST_URI’] returns full URL instead of path to script question on Stack Overflow.
The two cases are because the code to form secure URL is different, conditional on that possible difference in input.
Related Posts:
- Chrome 83 doesn’t connect WP login page after update from http to https on localhost
- Can’t login to WordPress without hitting the Remember Me checkbox. Potential SSL implementation bi-product
- Forcing SSL login, have to log in again from WP/BP-Admin Bar
- https to https problem – 404 and can’t login
- WordPress SSL not working [closed]
- Can’t login to wordpress, got ERR_EMPTY_RESPONSE after a few minutes
- Chrome incorrectly displaying WP login as ‘not fully secure’
- WordPress logs out on protocol switch
- In Django, how do I know the currently logged-in user?
- Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
- SSO / authentication integration with external ‘directory service’
- Preventing session timeout
- Check for correct username on custom login form
- ‘Password field is empty’ error when using autofill in Chrome
- Prevent wp_login_form() from redirecting to wp-admin when there are errors
- What exactly is ReAuth?
- What are the differences between wp_users and wp_usermeta tables?
- How to disable autocomplete on the wp-login.php page
- how to display the wordpress login and register forms on a page?
- How can I send a welcome email to a user AFTER they login for the first time?
- How can I add a custom script to footer of login page?
- Is it alright for two people to simultaneously be logged into a WP site as administrator?
- How do I turn off the ability to login?
- Give visitor access to password protected page/post via external script
- WordPress Login Footer URL
- moving server can not login
- Save last login date in global before change it?
- Is there a way to remove wp-login.php alias (login)?
- How to get login data (session) outside WordPress?
- password protect individual pages
- Change register form action url
- Remote REST request to check login status
- Is back-end access not required for an app to post to my blog?
- Store brute-force IP addresses
- How do I make my site publicly viewable? Everything redirects to wp-admin
- How to create a private login page for admin.?
- WordPress Security – How to block alternative WordPress access
- Protecting WordPress login page
- Different homepage for logged in users
- reset password link redirect to login page
- Deregister default wp-admin css on login screen only?
- SSO to WP, from a non-wp site on a different domain and server
- How can I login as admin after redirect to custom login page
- Login with serialized password
- is_user_logged_in() not working in Firefox
- Why would the login page reload indefinitely?
- Single sign on with custom site
- Set Default User Role
- Creating custom login errors
- Lock out all WordPress Administrators except two specific users
- Removing wordpress cookie from non-wordpress site
- Why is wp-login trying to send an email?
- Replacing default display name to login name
- Why does is_user_logged_in() return false after I change user password on the front end?
- How to generate “WP_Error” Object for user login?
- ?login=failed only attached to URL under certain circumstances
- WordPress not logged in locally with correct username and password
- my wp-login page doesn’t load [closed]
- Requiring login for specific pages
- login trouble WordPress can change IDs created by hoster site
- login/logout for only one page
- WordPress registration page template
- Removing “public” user registration without completely turning it off?
- Custom login modal page action
- Require re-login when logged-in user attempts to access restricted page
- Disable registration on certain condition
- Temporally disable password to login with empty password?
- How to force “remember me” users to login again?
- Login error when username as email different to primary email
- Unable to login my wordpress website
- PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
- Thank You Page Layout Differs on User Logged In Status
- How do you implement a login feature on a WordPress site?
- Help! ERROR: Cookies are blocked due to unexpected output on attempting to login to resolve an issue with my site
- How to log into WordPress admin in MAMP
- Can’t login with any account – No error message shown
- wp login password reset
- Cookies error during first time login attempt
- WordPress Network with SSL for multiple domains
- Site login failed due to strange warning
- Hide login page and use wp_login_form on ordinary pages
- Login screen keeps resetting?
- How can I customize the content of the login page?
- WordPress giving error when I log in after trying emergency.php
- Some crawlers/bots attempting to login with very good guesses. How?
- Create custom field for users to check if they agreed to terms
- loging to Admin page not working at all
- Can’t login through wp-login.php on fresh installation
- WordPress Cookies – wp_set_auth_cookie
- Authenticate return value
- Front-end login problem: requires re-authorization when accessing dashboard
- Using wp_login_form passowrd as undefined
- Redirect non-members to about/intro page
- Logging in takes a few refreshes to show you are logged in, is this a cache issue? [closed]
- When trying to login if already logged in, form just shakes – error message remains empty
- Handle POST request sent from an external site for login?
- Unable to login after adding ReCaptacha without API key
- How to create an alternative login page that does not use any plugins?
- Login and register by API
- Log in a user upon password reset?