The plugin uses the following endpoint to serve embed data:
/wp-json/initempo/v1/post
Starting from the latest version, it also supports an additional endpoint:
/wp-json/initempo/v1/product
Why Cache the Init Embed Posts REST API?
- Perfectly suitable: the content rarely changes => long-lasting cache with high efficiency
- Resource-saving: reduces the number of WordPress queries
- Faster embeds: external sites will display embed cards instantly
- Optimized for CDN: allows Cloudflare to serve content directly from edge servers
Additionally, the plugin already supports wp_cache_set() on the backend, so you can confidently pair it with a CDN like Cloudflare without worrying about stale content.
Accessing Cache Rules in Cloudflare
- Log in to Cloudflare and select your domain
- Go to the Caching tab → Cache Rules
- Click Create Rule
Create a Cache Rule for Init Embed Posts
Give your rule a name, such as Cache Init Embed Post API, then click Edit expression and enter this condition:
(http.host contains "example.com" and starts_with(http.request.uri.path, "/wp-json/initempo/v1") and not http.cookie contains "wordpress_logged_in_")
Note: Replace example.com with your actual domain.
Set Cache Behavior
- Cache status: On
- Edge TTL: Choose
86400s(1 day), or longer if your content doesn’t change often - Cache key: Click Add setting, then select Cache Deception Armor to protect against spoofed query strings
Click Deploy to save your rule.
Auto-Purging Cache When Content Updates?
If you want the API to reflect content updates automatically, install the Cloudflare for WordPress plugin and enable:
- Auto Purge Content On Update
This ensures the cached API content is purged whenever you update a post.
How to Verify If Cache Is Working
- Open a browser in Incognito mode
- Visit a site that embeds a post (or call the API directly)
- Open DevTools → go to the Network tab
- Find the request to
/wp-json/initempo/v1/... - Check the
cf-cache-statusresponse header. If it’s HIT, caching is active
Conclusion
The Init Embed Posts plugin helps you share WordPress post content beautifully, quickly, and automatically. Enabling REST API caching with Cloudflare significantly boosts performance—especially when the same post is embedded on multiple websites. This simple upgrade helps you deliver fast embeds, reduce server load, and create a smoother experience for your readers.
Comments