File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments