exit_on_http_head
Filter HookDescription
Filters whether to allow 'HEAD' requests to generate content. Provides a significant performance bump by exiting before the page content loads for 'HEAD' requests. See #14348.Hook Information
File Location |
wp-includes/template-loader.php
View on GitHub
|
Hook Type | Filter |
Line Number | 26 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$exit
|
Whether to exit without generating any content for 'HEAD' requests. Default true. |
Usage Examples
Basic Usage
<?php
// Hook into exit_on_http_head
add_filter('exit_on_http_head', 'my_custom_filter', 10, 1);
function my_custom_filter($exit) {
// Your custom filtering logic here
return $exit;
}
Source Code Context
wp-includes/template-loader.php:26
- How this hook is used in WordPress core
<?php
21 *
22 * @since 3.5.0
23 *
24 * @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
25 */
26 if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) ) {
27 exit;
28 }
29
30 // Process feeds and trackbacks even if not using themes.
31 if ( is_robots() ) {
PHP Documentation
<?php
/**
* Filters whether to allow 'HEAD' requests to generate content.
*
* Provides a significant performance bump by exiting before the page
* content loads for 'HEAD' requests. See #14348.
*
* @since 3.5.0
*
* @param bool $exit Whether to exit without generating any content for 'HEAD' requests. Default true.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/template-loader.php
Related Hooks
Related hooks will be displayed here in future updates.