Add an optional `$description` parameter to `status_header()` so custom HTTP status descriptions can be provided.
Fixes #21472 Props nbachiyski, iamfriendly Built from https://develop.svn.wordpress.org/trunk@34914 git-svn-id: http://core.svn.wordpress.org/trunk@34879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
17f53091ed
commit
c83a66cbf3
|
@ -981,16 +981,21 @@ function get_status_header_desc( $code ) {
|
||||||
* Set HTTP status header.
|
* Set HTTP status header.
|
||||||
*
|
*
|
||||||
* @since 2.0.0
|
* @since 2.0.0
|
||||||
|
* @since 4.4.0 Added the `$description` parameter.
|
||||||
*
|
*
|
||||||
* @see get_status_header_desc()
|
* @see get_status_header_desc()
|
||||||
*
|
*
|
||||||
* @param int $code HTTP status code.
|
* @param int $code HTTP status code.
|
||||||
|
* @param string $description Optional. A custom description for the HTTP status.
|
||||||
*/
|
*/
|
||||||
function status_header( $code ) {
|
function status_header( $code, $description = '' ) {
|
||||||
|
if ( ! $description ) {
|
||||||
$description = get_status_header_desc( $code );
|
$description = get_status_header_desc( $code );
|
||||||
|
}
|
||||||
|
|
||||||
if ( empty( $description ) )
|
if ( empty( $description ) ) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$protocol = wp_get_server_protocol();
|
$protocol = wp_get_server_protocol();
|
||||||
$status_header = "$protocol $code $description";
|
$status_header = "$protocol $code $description";
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.4-alpha-34913';
|
$wp_version = '4.4-alpha-34914';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue