Make WordPress Core

Ticket #14348: 14348-2.diff

File 14348-2.diff, 1.2 KB (added by technosailor, 13 years ago)

Following Otto's approach, this patch adds a new function httphead() that hooks on template_include and returns false if it's a HEAD request. This is immediately useful for us, but could also be plugin territory so... grain, salt.

  • wp-includes/default-filters.php

     
    174174// Misc filters
    175175add_filter( 'option_ping_sites',    'privacy_ping_filter'                 );
    176176add_filter( 'option_blog_charset',  '_wp_specialchars'                    ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
     177add_filter( 'template_include', 'httphead'                                                                );
    177178add_filter( 'option_home',          '_config_wp_home'                     );
    178179add_filter( 'option_siteurl',       '_config_wp_siteurl'                  );
    179180add_filter( 'tiny_mce_before_init', '_mce_set_direction'                  );
  • wp-includes/functions.php

     
    33113311        die();
    33123312}
    33133313
     3314function httphead( $template )
     3315{
     3316        if( $_SERVER['REQUEST_METHOD'] == 'HEAD' )
     3317                return false;
     3318               
     3319        return $template;
     3320}
     3321
    33143322/**
    33153323 * Converts value to nonnegative integer.
    33163324 *