Make WordPress Core

Changeset 22347


Ignore:
Timestamp:
10/31/2012 09:39:23 PM (12 years ago)
Author:
markjaquith
Message:

When receiving a HEAD request, die() right before we start outputting content.

  • Content doesn't make sense for HEAD requests
  • Saves wear and tear on the server
  • Introduces a filter: exit_on_http_head (we send TRUE through it)

fixes #14348. props mbijon, mitchoyoshitaka.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-loader.php

    r19712 r22347  
    66if ( defined('WP_USE_THEMES') && WP_USE_THEMES )
    77    do_action('template_redirect');
     8
     9/**
     10 * Halt template load for HEAD requests. Performance bump by eliminating output
     11 *
     12 * @since 3.5.0
     13 */
     14if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] && apply_filters( 'exit_on_http_head', true ) )
     15        exit();
    816
    917// Process feeds and trackbacks even if not using themes.
Note: See TracChangeset for help on using the changeset viewer.