0

Wordpress beginner here with a probably easy problem, yet I don't know how to do it. I want to disable caching on certain pages of my site.

I best describe what I do:

  • I have written a plugin in php
  • the php files (among other things) create a html that I insert via shortcode into a WP page
  • this html does use some javascript files - a leaflet map to be precise
  • on my site, the users can create such leaflet maps (on one page) and show them to the world (on another page)
  • Now when the user changes something on the authoring page, it is (most of the time) not shown on the audience page unless the user clears the cache.

I tried adding a random key to the .js file like this <script src="test.js?random=<?php echo uniqid(); ?>"></script> but it does not work.

I think I need to use some these hooks I keep hearing about, but I have no clue how.

If you want to see it in action, you can take a look at an audience page here or go ahead, make an account and test see the whole workflow.

  • It depends on what plugin you're using to cache the pages to begin with. Check its documentation. – Jacob Peattie Jun 17 at 1:33
  • I'm not using any caching plugins at all – Merion Jun 17 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.