Skip to content

Commit bb4e6d9

Browse files
committed
Revert "Revert "Suppress admin bar from being shown during validation requests""
This reverts commit 3380451 from #3187.
1 parent 6021df7 commit bb4e6d9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

includes/validation/class-amp-validation-manager.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,15 @@ function( $query_vars ) {
244244
add_action( 'wp', [ __CLASS__, 'override_validation_error_statuses' ] );
245245

246246
if ( self::$is_validate_request ) {
247+
/*
248+
* Always suppress the admin bar from being shown when performing a validation request. This ensures that
249+
* user-initiated validation requests perform the same as validation requests initiated by the WP-CLI
250+
* command `wp amp validate-site`, which does so as an unauthenticated user. Unauthenticated users should
251+
* not be shown the admin bar, and normal site visitors who read AMP content (such as via an AMP Cache) are
252+
* not authenticated, so it doesn't make sense to include the admin bar when doing validation.
253+
*/
254+
add_filter( 'show_admin_bar', '__return_false', PHP_INT_MAX );
255+
247256
self::add_validation_error_sourcing();
248257
}
249258
}

0 commit comments

Comments
 (0)