[wp-trac] [WordPress Trac] #64256: Add HTTP 500 status code for WordPress critical error messages

WordPress Trac noreply at wordpress.org
Sat Nov 15 14:28:19 UTC 2025


#64256: Add HTTP 500 status code for WordPress critical error messages
----------------------------+------------------------------
 Reporter:  swissky         |       Owner:  (none)
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Bootstrap/Load  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:                  |     Focuses:
----------------------------+------------------------------

Comment (by swissky):

 Thank you for the feedback! You're absolutely right on both points. I've
 updated the patch to address these issues.

 **Changes Made**

 1. Removed Redundant String Checks: The patch now uses a single, language-
 independent method instead of checking multiple strings.

 2. Language-Independent Solution: Instead of string matching (which fails
 with translations), the patch now:

 - **Checks for error code `'internal_server_error'`** - This is the code
 used by WordPress fatal error handler (see `class-wp-fatal-error-
 handler.php` line 238)
 - **Also checks `$parsed_args['code']`** - In case the code is set there
 instead
 - **Ensures HTTP 500 if response is already 500** - Covers cases where the
 fatal error handler already set it


 **Why This Works**

 1. **Language-independent**: Error code `'internal_server_error'` is
 always the same, regardless of language
 2. **Uses WordPress internals**: The fatal error handler creates WP_Error
 with this exact code
 3. **Covers all cases**: Checks both WP_Error code and parsed_args code
 4. **No redundancy**: Single, clear check

 The updated patch is attached.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64256#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list