When using WordPress REST API each request is processed by WordPress and depending on the size of the database and server performance, issues start occurring for high-traffic websites. By using a plugin such as WP REST Cache you can cache the responses of the REST API, making it much faster.
Enable caching of the WordPress REST API and auto-flush caches upon wp-admin editing.
Last Updated: 4 months ago
10,000+ Active Installs
Compatible with WordPress 4.7
Then if you want to always view uncached REST API responses you can add the following line to the request header:
Cache-Control: private or Cache-Control: no-cache
Apart from caching the response, there are also a few more methods to speed up WP REST API response time, here are some useful guides:
- WP Rest API too slow? – Yair Levy @medium
- WordPress REST API Slow Response time – WP Q&A
- WP REST API vs admin-ajax.php vs Must-Use Plugin: Handling AJAX Requests in WordPress
- Speeding Up WordPress REST API Response Times with Cached Data
Was this post helpful?
Let me know if you liked the post. That’s the only way I can improve. 🙂