Automattic / Automattic/wp-super-cache
Question: Dynamic caching: how to run the dynamic code on uncached pages?
- Dominant language
- PHP
- Stars
- 436
- Forks
- 130
- Avg merge
- 15h 11m
- Merged PRs (30d)
- 10
Description
### Impacted plugin
Super Cache
### Quick summary
I'm using the dynamic caching feature. For this, I "forked" dynamic-cache-test.php, so let's say I'm using `dynamic-cache-test.php`.
The settings page recommends turning off caching for connected users. However, if I disable caching for them, the secret tags are displayed instead of the code I want to run, late init enabled or not.
I have several questions:
- why is it recommended to turn off caching for connected users? My website seems fine with caching for connected users enabled.
- what is the common way to run the code that usually runs when pages are cached?
I've read those pages several times and I can't manage to understand how this should be done:
- https://wordpress.org/plugins/wp-super-cache/#how%20do%20i%20make%20certain%20parts%20of%20the%20page%20stay%20dynamic%3F
- https://odd.blog/2013/10/21/shiny-new-dynamic-content-wp-super-cache/
I guess a "fix" for this "bug" would be a small update to this faq page :-)
Thanks a lot for this plugin, very useful.
### Steps to reproduce
- add secret tags to https://github.com/Automattic/wp-super-cache/blob/a588daf6141c5072ec5eecf16d38a46ed2ad862a/plugins/dynamic-cache-test.php#L77 and https://github.com/Automattic/wp-super-cache/blob/a588daf6141c5072ec5eecf16d38a46ed2ad862a/plugins/dynamic-cache-test.php#L152
- Use them on a page
- Enable dynamic caching, but disable caches for connected users
- Notice how on the created page, the tags are replaced for a non connected users, but not replaced for connected users
### A clear and concise description of what you expected to happen.
I guess this is actually expected, but having secret tags not replaced when caching is disabled doesn't seem very helpful. secret tags should always be replaced, caching or not.
### What actually happened
There is no clear guidance on how to handle secret tags when pages are not cached.
### Impact
Some (< 50%)
### Available workarounds?
Yes, difficult to implement
### Platform (Simple and/or Atomic)
Self-hosted
### Logs or notes
I set "difficult to implement" because I guess enabling cache for connected users has side effects since it's recommended not to enable cache for connected users. Though in my case, it doesn't seem to cause any issues.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.