Filter hook 'status_header'

in WP Core File wp-includes/functions.php at line 1480

View Source

status_header

Filter Hook
Description
Filters an HTTP status header.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 1480

Hook Parameters

Type Name Description
string $status_header HTTP status header.
int $code HTTP status code.
string $description Description for the status code.
string $protocol Server protocol.

Usage Examples

Basic Usage
<?php
// Hook into status_header
add_filter('status_header', 'my_custom_filter', 10, 4);

function my_custom_filter($status_header, $code, $description, $protocol) {
    // Your custom filtering logic here
    return $status_header;
}

Source Code Context

wp-includes/functions.php:1480 - How this hook is used in WordPress core
<?php
1475  		 * @param string $status_header HTTP status header.
1476  		 * @param int    $code          HTTP status code.
1477  		 * @param string $description   Description for the status code.
1478  		 * @param string $protocol      Server protocol.
1479  		 */
1480  		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1481  	}
1482  
1483  	if ( ! headers_sent() ) {
1484  		header( $status_header, true, $code );
1485  	}

PHP Documentation

<?php
/**
		 * 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.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 4
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.