Skip to content

Commit

Permalink
Only unauthenticate user when parse_query is for the main query
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Feb 26, 2022
1 parent 749a985 commit 8a7880f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ function wp_add_error_template_no_robots() {
* will persist even after they have authenticated.
*
* @since 0.5
*
* @param WP_Query $query Query.
*/
function wp_unauthenticate_error_template_requests() {
if ( is_offline() || is_500() ) {
function wp_unauthenticate_error_template_requests( WP_Query $query ) {
if ( $query->is_main_query() && ( is_offline() || is_500() ) ) {
wp_set_current_user( 0 );
}
}
Expand Down

0 comments on commit 8a7880f

Please sign in to comment.