[wp-hackers] Sending a Last-Modified header with HTML pages
Dave W
dabbaking at gmail.com
Wed Nov 15 01:15:06 GMT 2006
Why is WP suppressing those header functions? If there are errors, no one is
gonna know and unsent headers might be a problem.
On 11/14/06, Brian Layman <Brian at thecodecave.com> wrote:
>
> > We're currently preparing to convert our blog to WordPress and
> > discovered that it isn't emitting Last-Modified headers for page views.
> > Can anyone provide some context on why WP has this behavior?
> The quick answer would be: Plugins and themes.
>
> In a general release, there are way to many ways for any particular WP
> page
> to change.
>
> Plugins, user settings and theme switchers all work against WP delivering
> a
> standard page.
>
> However, WP DOES use Last-Modified for all feeds. There even two
> detection
> methods, for the last modified date, based upon whether or not the feed
> includes comments.
>
> If you take a look at the function Send_Headers with in
> wp-includes/classes.php, you'll see the support for Last-Modified.
>
> If your page is really static, (and looking at your blog it is) you can
> easily fix the problem by MOVING (not copying) this code:
> // We're showing a feed, so WP is indeed the only thing that last
> changed
> if ( $this->query_vars['withcomments'] )
> $wp_last_modified = mysql2date('D, d M Y H:i:s',
> get_lastcommentmodified('GMT'), 0).' GMT';
> else
> $wp_last_modified = mysql2date('D, d M Y H:i:s',
> get_lastpostmodified('GMT'), 0).' GMT';
> $wp_etag = '"' . md5($wp_last_modified) . '"';
> @header("Last-Modified: $wp_last_modified");
> @header("ETag: $wp_etag");
>
> up right after the first line:
> @header('X-Pingback: '. get_bloginfo('pingback_url'));
>
> Another question might be, why don't we have a hook right there in
> send_header. It would be a good place for one. Is there an equivelent
> hook
> somewhere else?
>
> _______________________________________________
> Brian Layman
> www.TheCodeCave.com
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Dave W
More information about the wp-hackers
mailing list