Title: wp_headers
Published: April 25, 2014
Last modified: April 28, 2025

---

# apply_filters( ‘wp_headers’, string[] $headers, WP $wp )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#wp--skip-link--target)

Filters the HTTP headers before they’re sent to the browser.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#parameters)󠁿

 `$headers`string[]

Associative array of headers to be sent.

`$wp`WP

Current WordPress environment instance.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#source)󠁿

    ```php
    $headers = apply_filters( 'wp_headers', $headers, $this );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/class-wp.php#L563)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/class-wp.php#L563-L563)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#related)󠁿

| Used by | Description | 
| [WP::send_headers()](https://developer.wordpress.org/reference/classes/wp/send_headers/)`wp-includes/class-wp.php` |

Sends additional HTTP headers for caching, content type, etc.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/wp_headers/?output_format=md#comment-content-254)
 2.    [Nick C](https://profiles.wordpress.org/modernnerd/)  [  11 years ago  ](https://developer.wordpress.org/reference/hooks/wp_headers/#comment-254)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_headers%2F%23comment-254)
     Vote results for this note: -3[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_headers%2F%23comment-254)
 4.  This filter won’t allow you to modify headers if your site serves cached pages
     via a plugin or third-party caching system. The cached page will be served before
     your wp_headers are filtered.
 5.  You may be able to add an HTML meta tag with the http-equiv attribute using [wp_head()](https://developer.wordpress.org/reference/functions/wp_head/)
     to work around this for certain headers: [http://reference.sitepoint.com/html/meta/http-equiv](http://reference.sitepoint.com/html/meta/http-equiv)
 6.      ```php
         function gnu_terry_pratchett_meta() {
             if ( WP_CACHE ) {
                 echo '<meta http-equiv="X-Clacks-Overhead" content="GNU Terry Pratchett" />';
             }
         }
         add_action( 'wp_head', 'gnu_terry_pratchett_meta' );
         ```
     
 7.  Alternatively, explore setting headers at the server level with .htaccess or similar
     if you can.
 8.  `header set X-Clacks-Overhead "GNU Terry Pratchett"`
 9.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_headers%2F%3Freplytocom%3D254%23feedback-editor-254)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_headers%2F)
before being able to contribute a note or feedback.