-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Investigate better way to prevent snippets from caching #200
Comments
Thanks for adding this to your list. I wouldn't spend too much time on this. Initial issue solved via the plugin, Content No Cache. However, if and when you decide to look into this in more detail, here's what I recommend: Short-Term Solution: Create a code snippet (filter) that will allow bypassing the caching of other code snippets (via code snippet ID). Long-Term Solution: Modify the plugin settings page to add a new field, titled "Bypass Caching", with an open field next to it where users can enter the affected code snippet ID. Details: https://prnt.sc/WTC7n_ZG_GnI Useful Tip: Our team has worked with PHP/JS developers hired via Upwork to accomplish a similar project. Excellent results, project solved. It saved us a lot of time and money. Note: As you know, the above will require testing with all major caching plugins and CDNs to ensure no issues. Hope the above helps. Cheers! |
Thanks for the additional suggestions, it's really appreciated! This is definitely not the highest on our list of priorities, but I figured it was worth at least recording so we can revisit it at some point in the future. I think ideally, we will eventually just be able to add an option to the snippet edit screen where you can check a box asking this snippet to be excluded from caching, or even just a flag in the content shortcode/block/widget. |
Agree! I like the checkbox idea. :) Cheers! |
Is your feature request related to a problem? Please describe
We are curently using the code snippet provided below to display a message on the front end of our website (i.e., contact page) indicating whether our business is open or not.
In order for the code snippet to work, we had to disable caching on our contact page.
Describe the solution you'd like
Is there any way (via code snippet, ajax call) we can execute the code snippet provided below without the need to disable caching on our contact page?
Describe alternatives you've considered
Problem solved with another lightweight plugin: Content No Cache.
Additional context
Transposed from support thread by Generosus: How to Prevent PHP Code from Caching
The text was updated successfully, but these errors were encountered: