You call it asynchronously via the REST API.
In a best case scenario, you want the entire HTML of a page cached (full page cache). Executing PHP inside that is not easily possible and that’s exactly the idea behind it
So what you want is some JavaScript that talks to the REST API. The JavaScript code (your “logic“) must be written in a way that it does not need to change, so it can be embedded within the cached HTML. Your data that comes from the endpoint can change, because the endpoint is not cached in the same way as a site is.
Related Posts:
- W3 total cache – cache refresh programmatically [closed]
- Should I use Transient API to store HTML String, or Object?
- Caching: APC vs APCu vs OPcache
- Best way to show Dynamic Content on a Cached WordPress Site?
- Prevent WordPress from sending Cache-control http header
- Optimize apache for WP use
- Does a query executed through wpdb class get cached?
- Caching: Force fresh content for logged-in users (potentially by adding a query variable to the URL)
- Multiple WordPress sites eat up alot of RAM
- What exactly is an advanced object cache?
- Using a wildcard with delete_transient()
- How to purge all transient caches?
- Writing a cache manifest file for a WordPress blog (app cache, offline web applications)
- How to force content refresh of a page that has been loaded previously by the user? [closed]
- Help Pinpointing Source of Caching Issue
- Want to enforce the visitor to load the new version of your stylesheets and scripts [closed]
- Can someone explain WordPress caching, and what’s the best in my scenario?
- Transient / object cache maximum key length [duplicate]
- APC object caching in combination Batcache/memcached page caching?
- WordPress caching in development
- What is difference between ‘Page Cache’ and ‘Object Cache’ in WordPress?
- W3 total Cache – Site with query strings
- Possible to configure nginx to ignore cache for logged in users in certain roles only?
- Programmatically insert hierarchical terms & set terms for post causes glitch? [duplicate]
- Getting soft 404 errors (200 status) when caching plugins are enabled
- How to totally disable cache in WordPress?
- Automatically enabled caching in some hosting companies w/o visible plugin (Must use plugin)
- How to purge all transient caches?
- W3 Total Cache plugin integration
- server load. $_SERVER[‘REMOTE_ADDR’] and $_SERVER[‘HTTP_HOST’] [closed]
- Is it possible to save an entire piece of rendered HTML in a transient?
- Method to make definitively static an abandoned WP blog
- pass-protected pages and posts not protected after enter them 1 time
- Can a WordPress blog be entirely hosted on a CDN if cached?
- Static HTML page caching for large website [closed]
- To have WordPress interact with memcached it must be installed as a PHP extension?
- WordPress caching issue
- How can I revert to showing cached pages when no database connection is available? [closed]
- WP Super Cache Bug with Ubermenu
- Problem with caching, W3TC [closed]
- Reasonable Size Limit to options entry
- Is the object cached?
- How to find time last viewed?
- WP Rocket Cache Lifespan – Never clear cache? [closed]
- How to cache a different page version based on HTTP header?
- WP_Object_Cache for heavy WP_Query
- How to store or cache custom shopping cart data for every user’s session
- Live website is not showing the changes I’ve made [closed]
- Hook an action when a transient is deleted ? Can’t get it to work!
- Accelerate and clean up WordPress [closed]
- How to make page/post password protected so you must reenter everytime you visit the page?
- Fixed version number for cached stylesheets and javascript
- WebHostingBuzz cache statement
- Files cached as CSS or PHP?
- How effective are cacheing plugins for dynamic pages?
- How can I permanently cache or “archive” a WP blog without needing future maintenance
- A bunch of unrelated wordpress using same memcached don’t store correctly their datas
- RSS: fetch_feed caching with different caching delay per feed?
- How to be sure to get last page version without ANY cache?
- Is there a limit to size of data stored in update_option()?
- Last-Modified header support doesnât speed up server processing – want more
- HIgh CPU usage – Will using cache plugins help
- Browser cache for dynamic content (list of tags)
- Jetpack stats and caching strategy [closed]
- How to specify expiration of cacheable resources? [closed]
- How do I serve fully cached full HTML on cloudfront
- w3 total cache – Object Caching 2165/2469 objects? [closed]
- Get user name and caching system
- Changing WP Object Caching during runtime
- How to solve simple wp simple ajax chat caching problem
- dynamic page not displaying correctly when Varnish hosting ignores query string parameters
- How to not cache nonces with WP Rocket?
- What do I do if my WordPress site is suddenly sanitizing portions of URLs it shouldn’t?
- WordPress mobile version is not responsive anymore after installing varnish
- Admin area is caching posts in the editor
- How to make login / logout links cache independent?
- WordPress varnish pages printed twice
- Feed cache fallback – A feed could not be found
- WordPress Userroles button getting cached
- custom php file inside my custom folder of plugins directory is not caching
- w3 total cache uninstall remove cache
- How to let users clear their posts cache with WP Super Cache?
- Having 4000 posts, my site is so slow
- Super cache caches mobile pages for desktop
- Should I use transients for these API call results?
- cache reset button and question about deleting cache
- Cleared wp-cache and file is still not updated [closed]
- Bluehost WebHost and performance problems with W3TC [closed]
- W3 Total Cache Minification: way to revert back? [closed]
- get_theme_mod returning cached values regardless of apache restart
- Caching with dynamic content
- After Migration, Warning: include_once() errors on all pages
- Server Variables not recognized in certain posts
- Levels of caching and impact on the WordPress web site
- CSS changes not taking effect [closed]
- Experiencing a weird caching issues without any caching plugins
- Cannot add version of main.css to wordpress on testing enviroment
- Cache a number of responses from external json feeds?
- How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?
- Why does enabling caching break password protected pages? Is there a way around this?