Default first check for is_login() - #12864
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
irozum
left a comment
There was a problem hiding this comment.
Nice, focused optimization — skipping wp_login_url() for the common case where the login page hasn't moved is a reasonable fast path, and the new test suite is thorough (root/subdirectory installs, case-insensitivity, the login_url-filtered case, and — helpfully — the front-controller relocation pattern used by "hide login" plugins). Ran composer lint:errors and typecheck:php clean (the only PHPCS errors on this branch are pre-existing, in unrelated files), and the new Tests_Load_IsLogin suite passes 10/10.
On @westonruter's concern in the ticket: I traced through the actual mechanics of the relocation plugins mentioned (WPS Hide Login etc.), and they work by routing through the front controller with $pagenow forced to wp-login.php — SCRIPT_NAME stays /index.php, so the new fast path never fires there and falls through to the existing login_url-comparison logic unchanged (the PR's own test_should_not_detect_login_relocated_behind_front_controller covers this). The false-positive scenario he describes would require the literal wp-login.php file to still be directly reachable/executable while a filter defines the "real" login elsewhere entirely — a narrower case than the relocation plugins actually use. Worth adding to the Trac thread since it's a legitimate design question for committers to weigh in on, but I don't think it's a defect in this implementation.
One blocking nit: src/wp-includes/load.php:1331 tags the change @since 7.1.0, but trunk is feature-frozen at 7.1-RC2 — this enhancement should land as 7.2.0.
| * Determines whether the current request is for the login screen. | ||
| * | ||
| * @since 6.1.0 | ||
| * @since 7.1.0 Checks the default location first |
There was a problem hiding this comment.
Trunk is feature-frozen at 7.1-RC2 — this should be @since 7.2.0, not 7.1.0.
https://core.trac.wordpress.org/ticket/65820
AI assistance: Yes
Tool(s): Claude
Model(s): Opus 4.8
Used for: Claude wrote the tests in this change
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.