Filter hook 'wp_headers'

in WP Core File wp-includes/class-wp.php at line 563

View Source

wp_headers

Filter Hook
Description
Filters the HTTP headers before they're sent to the browser.

Hook Information

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

Hook Parameters

Type Name Description
string[] $headers Associative array of headers to be sent.
WP $wp Current WordPress environment instance.

Usage Examples

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

function my_custom_filter($headers, $wp) {
    // Your custom filtering logic here
    return $headers;
}

Source Code Context

wp-includes/class-wp.php:563 - How this hook is used in WordPress core
<?php
 558  		 * @since 2.8.0
 559  		 *
 560  		 * @param string[] $headers Associative array of headers to be sent.
 561  		 * @param WP       $wp      Current WordPress environment instance.
 562  		 */
 563  		$headers = apply_filters( 'wp_headers', $headers, $this );
 564  
 565  		if ( ! empty( $status ) ) {
 566  			status_header( $status );
 567  		}
 568  

PHP Documentation

<?php
/**
		 * Filters the HTTP headers before they're sent to the browser.
		 *
		 * @since 2.8.0
		 *
		 * @param string[] $headers Associative array of headers to be sent.
		 * @param WP       $wp      Current WordPress environment instance.
		 */
Quick Info
  • Hook Type: Filter
  • Parameters: 2
  • File: wp-includes/class-wp.php
Related Hooks

Related hooks will be displayed here in future updates.