WordPress at a glance

status_header() WP 1.0

Set HTTP status header.

Notes:

  • See: get_status_header_desc()
  • Since 4.4.0 Added the $description parameter.
Works based on: get_status_header_desc()
Hooks from function:
Return

Nothing (null).

Usage

status_header( $code, $description );
$code(int) (required)
HTTP status code.
$description(string)
A custom description for the HTTP status.
Default: ''

Code of status_header: wp-includes/functions.php VER 4.9.8

<?php
function status_header( $code, $description = '' ) {
	if ( ! $description ) {
		$description = get_status_header_desc( $code );
	}

	if ( empty( $description ) ) {
		return;
	}

	$protocol = wp_get_server_protocol();
	$status_header = "$protocol $code $description";
	if ( function_exists( 'apply_filters' ) )

		/**
		 * Filters an HTTP status header.
		 *
		 * @since 2.2.0
		 *
		 * @param string $status_header HTTP status header.
		 * @param int    $code          HTTP status code.
		 * @param string $description   Description for the status code.
		 * @param string $protocol      Server protocol.
		 */
		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );

	@header( $status_header, true, $code );
}

Related Functions

From tag: HTTP API (curl remote)

No comments
    Hello, !     Log In . Register