Skip to content

Fix /login 404 status code#2920

Open
cairocoder01 wants to merge 1 commit into
DiscipleTools:developfrom
cairocoder01:fix-login-404-code
Open

Fix /login 404 status code#2920
cairocoder01 wants to merge 1 commit into
DiscipleTools:developfrom
cairocoder01:fix-login-404-code

Conversation

@cairocoder01
Copy link
Copy Markdown
Collaborator

When enabling the SSO custom login page, although the page loads correctly, it technically returns a 404 status code. The same is true of the privacy and terms pages. This resolves that by setting a 200 status for those pages.

When enabling the SSO custom login page, although the page loads correctly, it technically returns a 404 status code. The same is true of the privacy and terms pages. This resolves that by setting a 200 status for those pages.
@github-actions
Copy link
Copy Markdown

Code Review

No High or Medium severity issues found.

What the PR does

Fixes HTTP 404 status codes being sent for pages that render successfully — the custom SSO login page, privacy policy, and terms of service pages. WordPress sets these pages up on virtual URLs it doesn't know about, so WP_Query marks them as 404 even though content is served. The existing $wp_query->is_404 = false in login-template.php only prevented WordPress from selecting the 404 template; it didn't affect the actual HTTP response code. Adding status_header( 200 ) is the correct complement.

Observations

  • dt-login/pages/base.php:18 — Placing status_header( 200 ) at the top of theme_redirect() is the right location: it runs before include( $path ) sends any output, and it covers all three virtual pages that inherit this method (privacy-policy.php, terms-of-service.php, registration-holding.php).

  • dt-login/login-template.php:25 — This call is technically redundant for the login page path, since theme_redirect() in base.php already emits status_header( 200 ) before template-blank.php is included (which eventually calls body()login-template.php). That said, it's a harmless defensive addition that makes the intent clear within the template itself, and correctly pairs with the existing $wp_query->is_404 = false on the line above.

The PR is minimal, targeted, and correct. Ready to merge.

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.

1 participant