The Esquina Shortcodes Plugin caches all external API responses using the native WordPress transients API (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Jhon-mantila/pluging-wordpress/llms.txt
Use this file to discover all available pages before exploring further.
set_transient / get_transient). Caching prevents your YouTube Data API quota and Facebook Graph API rate limits from being consumed on every page view, and dramatically improves page load time for visitors — the API is only called when a cached result has expired or does not yet exist.
YouTube Caching
YouTube API results are cached at two levels: the uploads playlist ID is cached separately from the actual video data, and AJAX sessions maintain their own short-lived transients for deduplication.Video Feed Cache
| Property | Value |
|---|---|
| TTL | 12 hours (ESQUINA_YT_CACHE_TTL = 12 * HOUR_IN_SECONDS) |
| Cache key | esquina_yt_v5_{md5(channel_id|mode|first_count|max|api_key_prefix)} |
long or short), the number of videos in the first batch, the max value, and the first 12 characters of a SHA-256 hash of the API key. This ensures that different shortcode configurations on the same site each get their own cache entry.
The cached value is an associative array:
Uploads Playlist ID Cache
The plugin derives the uploads playlist ID from the channel ID mathematically (UC… → UU…) without an API call. The result is cached as a safety measure in case the derivation logic ever needs an API fallback:
| Property | Value |
|---|---|
| TTL | 24 hours (DAY_IN_SECONDS) |
| Cache key | esquina_yt_uploads_pl_{md5(channel_id)} |
AJAX Session Caches
Whenmax="all" mode is active, two additional transients are created per feed instance at page render time:
| Transient | TTL | Purpose |
|---|---|---|
esquina_yt_s_{session_id} | 1 hour (HOUR_IN_SECONDS) | Stores api_key, channel_id, and mode — the API key never leaves the server |
esquina_yt_seen_{session_id} | 1 hour (HOUR_IN_SECONDS) | Tracks seen video IDs across paginated AJAX requests to prevent duplicate cards |
Facebook Caching
Facebook Graph API responses are cached with a much shorter TTL because Facebook post feeds update far more frequently than YouTube video libraries.| Property | Value |
|---|---|
| TTL | 5 minutes (5 * MINUTE_IN_SECONDS) |
| Cache key | esquina_fb_{md5(page_id . '_' . limit . '_' . after)} |
after cursor is an empty string) is cached. Subsequent AJAX requests for deeper pages are always fetched live from the Graph API.
The cached value is an associative array:
Cache Invalidation
WordPress transients expire automatically based on their TTL. You do not need to do anything for normal cache rotation. To clear the cache manually — for example, after publishing an important new video or post — you can use any of the following approaches:Object Cache Compatibility
If your site uses a persistent object cache — such as Redis or Memcached — backed by a caching plugin (e.g., Redis Object Cache, W3 Total Cache object cache module), WordPress transients are automatically stored there instead of the
wp_options database table. The Esquina Shortcodes Plugin works correctly with any WP-compatible persistent cache backend. Cache invalidation via delete_transient() is also handled transparently by WordPress regardless of the backend in use.High-Traffic Recommendation
Related Pages
AJAX Loading
How AJAX session transients keep the YouTube API key off the browser.
YouTube Largo Shortcode
The
[youtube_largo] shortcode whose results are cached for 12 hours.Facebook Posts Shortcode
The
[facebook_posts] shortcode whose first-page results are cached for 5 minutes.Performance Tips
Additional strategies for optimising plugin performance on high-traffic sites.