Title: Avoid caching
Last modified: August 22, 2016

---

# Avoid caching

 *  [Dongo Bongo](https://wordpress.org/support/users/nexum2000/)
 * (@nexum2000)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/avoid-caching-1/)
 * Hi, I’m using W3 Total Cache and I want to avoid caching of this plugin. So I
   try to implement fragment caching by puting the code in stock_widget_display.
   php between <!– mfunc W3TC_DYNAMIC_SECURITY –>any PHP code<!– /mfunc W3TC_DYNAMIC_SECURITY–
   >. This action gives an error which states that namespace declaration must be
   first in the .php file.
    Can you please inform how can we avoid caching of this
   plugin? Thanks.
 * [https://wordpress.org/plugins/custom-stock-widget/](https://wordpress.org/plugins/custom-stock-widget/)

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

 *  Plugin Author [Relevad](https://wordpress.org/support/users/relevad/)
 * (@relevad)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/avoid-caching-1/#post-5809170)
 * Hi there,
 * I put in a feature request for us to figure this out. We’ll update here.
 *  Plugin Author [Relevad](https://wordpress.org/support/users/relevad/)
 * (@relevad)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/avoid-caching-1/#post-5809171)
 * Initial review.
 * If using a namespace declaration it must be the first statement of php code in
   the file.
    [http://php.net/manual/en/language.namespaces.definition.php](http://php.net/manual/en/language.namespaces.definition.php)“
   A file containing a namespace must declare the namespace at the top of the file
   before any other code”
 * Therefore you cannot simply wrap the entire php file in the
    <!– mfunc <?php 
   echo W3TC_DYNAMIC_SECURITY; ?> –> tags. We do not yet know the best place to 
   put those tags in or in how many files of our plugin they would need to be attached
   to.
 * I found this documentation:
    [http://justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/](http://justinsilver.com/technology/wordpress/w3-total-cache-fragment-caching-wordpress/)
   Which says removal of <?php ?> tags from the codeblock to be fragment cached 
   is required.
 * If you come up with a working solution before we do, please let us know and we’ll
   incorporate it in a future release.
    Otherwise the feature request has been added
   to our queue.
 *  [nikydox](https://wordpress.org/support/users/nikydox/)
 * (@nikydox)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/avoid-caching-1/#post-5809191)
 * It would be a very good update.

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

The topic ‘Avoid caching’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-stock-widget.svg)
 * [Custom Stock Widget](https://wordpress.org/plugins/custom-stock-widget/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-stock-widget/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-stock-widget/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-stock-widget/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-stock-widget/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-stock-widget/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [nikydox](https://wordpress.org/support/users/nikydox/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/avoid-caching-1/#post-5809191)
 * Status: not resolved