-
Notifications
You must be signed in to change notification settings - Fork 100
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
Only unauthenticate user when parse_query
is for the main query
#712
Only unauthenticate user when parse_query
is for the main query
#712
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #712 +/- ##
==========================================
Coverage 19.96% 19.96%
Complexity 326 326
==========================================
Files 56 56
Lines 2094 2094
==========================================
Hits 418 418
Misses 1676 1676
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -75,4 +75,24 @@ public function test_wp_unauthenticate_error_template_requests( $request_url, $a | |||
$this->assertEquals( 0, get_current_user_id() ); | |||
} | |||
} | |||
|
|||
/** | |||
* Test that that `wp_unauthenticate_error_template_requests()` running at the `parse_query` action doesn't cause |
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.
* Test that that `wp_unauthenticate_error_template_requests()` running at the `parse_query` action doesn't cause | |
* Test that `wp_unauthenticate_error_template_requests()` running at the `parse_query` action doesn't cause |
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.
Changes LGTM 👍🏼
This is a follow-up to #279 and it addresses a conflict with Polylang identified in a support topic.
The issue is that if a
WP_Query
instance is created before the main query, then this can result in ourwp_unauthenticate_error_template_requests()
running on theparse_query
action when there is no$wp_query
global yet set. The result is a notice:The fix is simply to ensure that the query being parsed is the main query, because that will ensure that the
$wp_the_query
has been set, at which point the$wp_query
global has already been set.Fixes #538.