Title: W3TC Filter Docs
Last modified: September 16, 2019

---

# W3TC Filter Docs

 *  Resolved [Brad](https://wordpress.org/support/users/saskso/)
 * (@saskso)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/)
 * Is there documentation for any filters exposed by W3TC and could I use those 
   to add a global preconnect http header for my image CDN? Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Joseph W](https://wordpress.org/support/users/joe9663/)
 * (@joe9663)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11944832)
 * Hi [@saskso](https://wordpress.org/support/users/saskso/),
 * Unfortunately there is no documentation for filters exposed by W3TC, but we are
   happy to provide any advice we can.
 * What exactly are you referring to and trying to achieve by setting up a global
   preconnect http header for your image CDN?
 *  Thread Starter [Brad](https://wordpress.org/support/users/saskso/)
 * (@saskso)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11946017)
 * I want a preconnect http header to be sent that tells the browser to preconnect
   to my image CDN so images load faster. It is part of the Link part of the http
   header. With cached pages if I try to use another plugin that modifies HTTP headers
   it doesn’t work since W3TC controls the cache pages and bypasses WordPress and
   the plugins. So, I was hoping there is a W3TC filter or some other way to tell
   W3TC to add a http link header specifying my image CDN. The link http header 
   would look something like below:
    `link: <https://res.cloudinary.com>; rel=preconnect`
 * Thank you.
    -  This reply was modified 6 years, 7 months ago by [Brad](https://wordpress.org/support/users/saskso/).
 *  Thread Starter [Brad](https://wordpress.org/support/users/saskso/)
 * (@saskso)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11946682)
 * As a workaround (but would still prefer a filter if there is one as discussed
   at the end below) you can add a link header to the .htaccess file in the page
   cache directory for w3tc.
 * As a pre-caution, I surrounded it by the files directive because I wanted to 
   be sure it didn’t get added to anything but html pages but probably not necessary
   since there are no images or scripts etc., in the page cache dir…..
 *     ```
       <Files ~ "\.(html|html_gzip|html_br)$">
       Header add Link "</wp-includes/js/jquery/jquery.js>; rel=preload; as=script"
       </Files>
       ```
   
 * I also tried Header add Link “</wp-includes/js/jquery/jquery.js>; rel=preload;
   as=script” and saw it pushed in Chrome.
 * I am not quite marking this as resolved yet because I would like to know from
   W3TC support if there is a filter to add a http header. If there was a filter
   then I could use code to push for example a CSS or JS file that changes often
   like say the ones from the Autoptimize plugin. I cannot push those with a .htaccess
   header because they change.
 * So, is there a filter to add a http header with W3TC? If not, it would be nice
   to add one that other plugins could hook into since the caching bypasses everything
   and won’t include any headers other plugins try to set or that I set functions.
   php.
 * Thank you.
 * Edit: fixed editor malforming link code I used by using code tag, I think….
    -  This reply was modified 6 years, 7 months ago by [Brad](https://wordpress.org/support/users/saskso/).
    -  This reply was modified 6 years, 7 months ago by [Brad](https://wordpress.org/support/users/saskso/).
    -  This reply was modified 6 years, 7 months ago by [Brad](https://wordpress.org/support/users/saskso/).
 *  [Joseph W](https://wordpress.org/support/users/joe9663/)
 * (@joe9663)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11950520)
 * Hi [@saskso](https://wordpress.org/support/users/saskso/), thank you for following
   up with this issue.
 * When using Disk: Enhanced as your caching method, the headers are iterated over
   and added within [https://github.com/W3EDGE/w3-total-cache/blob/master/Cache_File_Generic.php#L100](https://github.com/W3EDGE/w3-total-cache/blob/master/Cache_File_Generic.php#L100)
   which would need to be extended to allow the functionality you intend, such as
   including or excluding specific items from being added to the header.
 * Caching methods other than Disk: Enhanced do not have this limitation, so I would
   suggest to use an alternative method if possible.
 * I have also created a [feature suggestion with the developers](https://github.com/W3EDGE/w3-total-cache/issues/50)
   to add your requested filter functionality in a future version.
 * I hope that this information helps you make the customizations you need to work
   with your image CDN and please let us know if there is anything else that we 
   can do to assist!
 *  Thread Starter [Brad](https://wordpress.org/support/users/saskso/)
 * (@saskso)
 * [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11955530)
 * Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘W3TC Filter Docs’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Brad](https://wordpress.org/support/users/saskso/)
 * Last activity: [6 years, 7 months ago](https://wordpress.org/support/topic/w3tc-filter-docs/#post-11955530)
 * Status: resolved