You’re saving the data in a loop under the same key for each iteration. You’ll have to add the index of the current iteration of the loop to the key if you want a unique value for each. Something like:
$i = 0;
while ( have_rows('images') ): the_row();
fragment_cache('cms_images_text_' . $i . '_' . $post->ID, WEEK_IN_SECONDS, function() {
$gallery_image = get_sub_field('image');
$gallery_image_small = $gallery_image['sizes']['square-small'];
echo '<img src="' . $gallery_image_small . '">';
});
$i++;
endwhile;
Or perhaps just save the entire loop’s contents under a single key.
Related Posts:
- When should I be using the Transients API?
- Cache remote (HTTP) request with Transients API
- Is there any danger in deleting all transients?
- Why are transients cleared prematurely?
- Get a list of existing transients
- Storing posts social counters by using transient api
- How to save new transients if query changes?
- Integrating WP-TLC-Transients with WordPress – Where to Begin?
- Is priming a Transient Cache possible?
- What causes a transient to changes status to “Does Not Expire”?
- Reset Transient on New Day
- Transient storage location? database/xcache/w3Total Cache?
- How to delete transients written by fetch_feed()?
- Set Transient expiration
- WordPress transient doesn’t use the transient
- How do I reset a transient when updating a widget’s value?
- How to clear Transients on all sites in Multi Sites environment
- Is this the proper usage of creating / using a transient?
- Should I use the Transients API to temporarily hold edited attachements?
- transient or not transient
- Can Transients be used to store sensitive data?
- wp_options flooded with transient API entires
- Why Transients may not work correctly?
- How many transients is too many transients
- Synchronize Data every minute with set_transient
- Difference between get_site_transient() and get_transient()
- delete_transient on click inside a widget form
- Set_Transient to end at midnight
- Whats wrong with this transient? Not caching as expected
- Set transient with get posts error
- Clear Transients
- Unique Transients user id for Non-Logged In users
- Transient is never set. Why?
- Button to clear transients
- Set transient name
- Hacked site using transient API?
- Ajax call to transients
- Why can’t I save encrypted data in a transient?
- Doesn’t set_transient() add multiple rows with the same key?
- Should I use Transient API to store HTML String, or Object?
- Best practices for using the transients API
- Are transients private or public?
- Using transients in conjunction with memcached
- Using a wildcard with delete_transient()
- Does set_transient() overwrite/update transient option with same key?
- Does using set_transient() function can lead to MySQL problems?
- Fallback when Transient API fails
- How to delete cached transients from a widget instance properly?
- How to purge all transient caches?
- Should the caching of WordPress menus be specific to each page?
- Long option names fail silently?
- Use Transient API to cache queries for all posts in all categories?
- Looping through posts per category gives same posts for each category
- Transient pagination not working properly
- pre_set_site_transient_update_plugins wont call on hosted webspace
- Transient / object cache maximum key length [duplicate]
- WP_Query Performance Issues with meta_query
- wp_transients | wp_object_cache VS SESSIONS & Cookies?
- How can I store an image in the database with Transients API?
- Must I serialize/sanitize/escape array data before using set_transient?
- How to purge all transient caches?
- Transient API and caching Plugins
- How to cache posts based on $_GET? Option name is too long? Options / transients
- WordPress Caching – Transients API or “update_user_meta ” Cronjob?
- Messing up with transient API – getting flushed on refresh
- Any insights into Transient API locking, cron and threading?
- how to build (custom) stats for post views, per month
- Transient unique names
- Set Transient does nothing
- Force Plugin Updates: “Update Failed: Plugin update failed.” after update one plugin
- Storing product price data in the database
- Transient feeds and caching error
- Transient loop issue
- Delete transients in website
- is_wp_error() and handling errors
- How to store or cache custom shopping cart data for every user’s session
- Hook an action when a transient is deleted ? Can’t get it to work!
- Why does get_transient() always return string even if integer set?
- What is the best practice to set and update Transient value of API data in every minute?
- Using transient for dynamic css , how to name it?
- Reset all transients on post or page save
- What is the best way (regarding performance) to set transients for logged in users?
- Set WordPress Transient Expiration via Variable Value
- Updating transient value frequently
- Search transients through widget
- Custom Plugin Options Won’t Update
- Is there a better way to access transients using javascript
- Storing transients giving database error
- Save large WP_Query to transient === false
- Woocommerce – how to round up all prices to end in .99
- Check the stored / cached WP_Query with transients on post change
- wp_trash_post() duplicates post to trash
- What is the best way to upload a temporary & sensitive file and then delete it when done
- Show the online status of the current post’s author
- Should I use transients for these API call results?
- Transient Loop Not working as expected
- What is the best way to cache pages and queries in WordPress?
- How get JSON from external API on every page load if not existing in transient?
- How can I stop my WordPress database collecting transients such as RSS feeds in wp_options table?
- How can I wordpress cache a database request with no existing plugin?