- if ( !empty($this->query_vars['error']) && '404' == $this->query_vars['error'] ) {
- $status = 404;
- if ( !is_user_logged_in() )
- $headers = array_merge($headers, wp_get_nocache_headers());
- $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+ if ( ! empty( $this->query_vars['error'] ) ) {
+ $status = (int) $this->query_vars['error'];
+ if ( 404 === $status ) {
+ if ( ! is_user_logged_in() )
+ $headers = array_merge($headers, wp_get_nocache_headers());
+ $headers['Content-Type'] = get_option('html_type') . '; charset=' . get_option('blog_charset');
+ } elseif ( in_array( $status, array( 403, 500, 502, 503 ) ) ) {
+ $exit_required = true;
+ }