Project

General

Profile

Features

The following section briefly describes the Add-Headers features by going into the details of how it works.

Introduction

Add-Headers gives you control over the ETag, Last-Modified, Expires and Cache-Control HTTP headers which your WordPress powered web site sends back to the clients when dynamic pages are requested.

It also lets you filter its configuration options programmatically in order to make the plugin work according to the special needs of your web site.

This gives you control over the way your dynamic content is cached by web browsers or caching proxy servers. If configured properly for your web site's specific needs, it can result in more efficient caching of your content and thus reduce the bandwidth consumption and server load.

Add-Headers does not have a web based administration panel in the WordPress admin area. This is by design as we need much flexibility while configuring the plugin for the special needs of a web site. But, there should be no worries, as configuration is very easy.

How it works

The aforementioned HTTP headers are sent to the client when visiting:

  • posts
  • pages
  • attachment pages
  • custom post types
  • the front page (static pages are supported)
  • archives (category, tag, custom taxonomy term, custom post type, author or date based archives, including paginated pages, are supported).
  • feeds, including posts feed, comments feed, post comments feed, archive feeds (all feed types are supported).
  • search results pages are supported (no caching is permitted by default).

The value of each header is based on information provided by the post object in each of the above pages.

In case of content pages (posts, pages, custom post types), the time the content has been last modified is determined by the time the content was last edited or by the creation time of the latest comment, whichever of the two is newer.

In case of archives, the first post is used in order to determine the time the archive was last modified. It is possible to customize this by utilizing the addh_archive_post filter. Special consideration has been taken so that ETags are unique, even if a post appears first in more than one archives.

In case of feeds, the ETag and the Last-Modified headers are generated by WordPress itself. Add-Headers adds its own ETag and Last-Modified headers to the response. Please note that if the generation of these two headers has been deactivated in the Add-Headers configuration options, then the ETag and Last-Modified headers, which have been generated by WordPress, are still sent to the client. To make Add-Headers clear any pre-existing headers, you will have to enable the remove_pre_existing_headers option.

By default, the max age and thus the expiration date of each page, which is supposed to be cached, is set to zero seconds, which results in sending non-caching headers to the clients. In order to make the dynamic HTML pages cacheable, you will have to enter a positive integer value to the cache_max_age_seconds option, which the number of seconds the page should be cached after it has been accessed by the client.

In addition to the Cache-Control header, the plugin also sets the Pragma header to public or no-cache according to the defined max age of the Cache-Control header.

Notice regarding the functionality of 2.X.X releases

In Add-Headers releases older than 2.0.0 caching was enabled by default. This resulted in several users, who didn't have the required knowledge about HTTP caching, assuming that the plugin would somehow auto-configure itself according to their web sites' special needs. So, since 2.0.0, configuration of this plugin has become mandatory.

Warning

Be advised that, if your web site includes contact forms, shopping carts, real time data or other special pages which contain HTML elements that need to be refreshed on every visit, the customization of the plugin configuration is mandatory for those special pages, so as to prevent them from getting cached by web browsers and caching proxies. Read the Configuration page for more information and examples.