Support » Plugin: Custom Stock Widget » Avoid caching

  • 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?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Relevad


    Hi there,

    I put in a feature request for us to figure this out. We’ll update here.

    Plugin Author Relevad


    Initial review.

    If using a namespace declaration it must be the first statement of php code in the file.
    “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; ?> –>
    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:
    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.

    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.