Title: modify final output
Last modified: July 12, 2018

---

# modify final output

 *  [ionutm](https://wordpress.org/support/users/ionutm/)
 * (@ionutm)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/)
 * hi
 * great plugin i have just one question
    is there any method to modify the final
   output ?

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

 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10487670)
 * If you want to be able to modify cached content, you should use Page Cache `Disk:
   Basic` and fragment caching, which is built to allow dynamic content and still
   partly cache the pages.
 *  Thread Starter [ionutm](https://wordpress.org/support/users/ionutm/)
 * (@ionutm)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10489961)
 * thanks for responding
    i am using the disk cache i just need a action, filter,
   etc to programmatically modify the content before is cached
 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10489999)
 * There is no specific filter or action for that. The cache is built upon GET request.
   A page is requested, the page is built the normal WordPress way, the result is
   stored in a cache file or in memory (depending on what method you use). The page
   is cached as a visitor will see the website. If you want some dynamic content
   to have something like products you viewed before, you should use fragment cache
   as that part of the page will not be cached. Fragment cache is something like
   this:
 *     ```
       <!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
       echo 'The time is '.date( 'H:i:s', time() );
       <!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
       ```
   
 * where YOUR_CODE is defined in your wp-config.php file and should be something
   unique so hackers will not be able to use it.
 *  Thread Starter [ionutm](https://wordpress.org/support/users/ionutm/)
 * (@ionutm)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10490021)
 * i need to change some strings right before the cache is saved.
    the strings are
   not dynamic so i don’t need to modify the output every time just when the cache
   changes.
 * i want o change every `rel="stylesheet"` to `rel="preload" as="style" onload="
   this.rel='stylesheet'"`
 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10490055)
 * You should use a filter or action to modify the output of the enqueued styles.
   You just want to change the result of the page, even if W3 Total Cache is disabled.
   This is not really related to the Page Cache.
 *  Thread Starter [ionutm](https://wordpress.org/support/users/ionutm/)
 * (@ionutm)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10490062)
 * if i change it before W3 Total Cache does it’s job i lose the concatenation/minification
   done by the plugin and i don’t want that.
 * i need to modify the content after the plugin did his job.
 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10490100)
 * Now I understand your problem clearly. We do not have a filter or action to modify
   this. I’ll discuss this with the team and come back to you ASAP.
 *  Thread Starter [ionutm](https://wordpress.org/support/users/ionutm/)
 * (@ionutm)
 * [7 years, 9 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10490132)
 * thanks a lot 🙂 sorry if i was not clear from the start
 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10762911)
 * [@ionutm](https://wordpress.org/support/users/ionutm/) It’s been a while, sorry
   for that. I recently was asked for a similar feature and we came up with this:
 * Use `add_filter('w3tc_pagecache_set', 'callback');` where the callback will receive
   the HTML output as first parameter and must return the modified output. This 
   filter is called just before we store the output in a cache file.
 * Note that this is only applicable if you’re using Page Cache, but I assume you
   do.

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

The topic ‘modify final output’ 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/)

 * 9 replies
 * 2 participants
 * Last reply from: [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/modify-final-output/#post-10762911)
 * Status: not resolved