Make WordPress Core

Changeset 34914


Ignore:
Timestamp:
10/07/2015 09:25:54 PM (9 years ago)
Author:
johnbillion
Message:

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

Fixes #21472
Props nbachiyski, iamfriendly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r34912 r34914  
    982982 *
    983983 * @since 2.0.0
     984 * @since 4.4.0 Added the `$description` parameter.
    984985 *
    985986 * @see get_status_header_desc()
    986987 *
    987  * @param int $code HTTP status code.
    988  */
    989 function status_header( $code ) {
    990     $description = get_status_header_desc( $code );
    991 
    992     if ( empty( $description ) )
     988 * @param int    $code        HTTP status code.
     989 * @param string $description Optional. A custom description for the HTTP status.
     990 */
     991function status_header( $code, $description = '' ) {
     992    if ( ! $description ) {
     993        $description = get_status_header_desc( $code );
     994    }
     995
     996    if ( empty( $description ) ) {
    993997        return;
     998    }
    994999
    9951000    $protocol = wp_get_server_protocol();
Note: See TracChangeset for help on using the changeset viewer.