WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#21472 closed enhancement (fixed)

Allow supplying a custom text to status_header()

Reported by: nbachiyski Owned by: johnbillion
Milestone: 4.4 Priority: normal
Severity: minor Version:
Component: General Keywords: has-patch commit
Focuses: Cc:

Description

Problem: I'd like to issue a HTTP 500 error, but include a text different from Internal Server Error, so that the client knows what caused the error.

Currently for a known error code the status_header() function always uses the global array $wp_header_to_desc and the only way to have my own text is to set the value in the global array.

The patch adds a second a argument to status_header().

Attachments (3)

status-header-custom-text.diff (699 bytes) - added by nbachiyski 7 years ago.
21472.diff (764 bytes) - added by iamfriendly 4 years ago.
Refreshed the patch and added docs
21472.2.diff (941 bytes) - added by johnbillion 4 years ago.

Download all attachments as: .zip

Change History (8)

#1 @DrewAPicture
5 years ago

  • Keywords needs-refresh needs-docs added

The patch needs a refresh since [25990], and also docs for the new parameter.

@iamfriendly
4 years ago

Refreshed the patch and added docs

#2 @iamfriendly
4 years ago

  • Keywords needs-refresh needs-docs removed

Refreshed the patch and added the docs for the new parameter

#3 @johnbillion
4 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to johnbillion
  • Status changed from new to reviewing

@johnbillion
4 years ago

#4 @johnbillion
4 years ago

  • Keywords commit added

#5 @johnbillion
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 34914:

Add an optional $description parameter to status_header() so custom HTTP status descriptions can be provided.

Fixes #21472
Props nbachiyski, iamfriendly

Note: See TracTickets for help on using tickets.