Skip to content

Default first check for is_login() - #12864

Open
josephscott wants to merge 1 commit into
WordPress:trunkfrom
josephscott:fix/is-login-fast-path
Open

Default first check for is_login()#12864
josephscott wants to merge 1 commit into
WordPress:trunkfrom
josephscott:fix/is-login-fast-path

Conversation

@josephscott

Copy link
Copy Markdown
Contributor

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.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props josephscott.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@irozum irozum left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.phpSCRIPT_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.

Comment thread src/wp-includes/load.php
* Determines whether the current request is for the login screen.
*
* @since 6.1.0
* @since 7.1.0 Checks the default location first

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trunk is feature-frozen at 7.1-RC2 — this should be @since 7.2.0, not 7.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants