Speed Up Your WordPress by Caching Custom Queries using Transients API


Speed Up Your WordPress by Caching Custom Queries using Transients API
Eustolia Wilks

So this whole caching and transient lingo is going over my head. Well don’t worry let us explain what it does. Basically if you are running a site like List25 and have a loop that shows 6 random posts in your sidebar, then transient API can help. Every time a user refreshes the page, that custom WP Query that you have will go in your database and pull 6 posts at random. If you are a relatively new site, it shouldn’t be that bad. But if you are getting A LOT of people to your site, then it can crash your SQL server, and you will see the “Error Establishing Database Connection” screen. By adding a few extra lines of code, you can easily store the results of that query (cache it) for a certain period of time using the Transients API.

Speed Up Your WordPress by Caching Custom Queries using Transients API
Marie Wilson

So this whole caching and transient lingo is going over my head. Well don’t worry let us explain what it does. Basically if you are running a site like List25 and have a loop that shows 6 random posts in your sidebar, then transient API can help. Every time a user refreshes the page, that custom WP Query that you have will go in your database and pull 6 posts at random. If you are a relatively new site, it shouldn’t be that bad. But if you are getting A LOT of people to your site, then it can crash your SQL server, and you will see the “Error Establishing Database Connection” screen. By adding a few extra lines of code, you can easily store the results of that query (cache it) for a certain period of time using the Transients API.

Speed Up Your WordPress by Caching Custom Queries using Transients API
Miranda Burgess

So this whole caching and transient lingo is going over my head. Well don’t worry let us explain what it does. Basically if you are running a site like List25and have a loop that shows 6 random posts in your sidebar, then transient API can help. Every time a user refreshes the page, that custom WP Query that you have will go in your database and pull 6 posts at random. If you are a relatively new site, it shouldn’t be that bad. But if you are getting A LOT of people to your site, then it can crash your SQL server, and you will see the “Error Establishing Database Connection” screen. By adding a few extra lines of code, you can easily store the results of that query (cache it) for a certain period of time using the Transients API.

Be the first to comment

Leave a Reply

Your email address will not be published.


*