WordPress VIP Caching
By: Ryan Kienstra on: January 5, 2015 in: WordPress VIP
Many of the WordPress VIP coding standards are meant to ensure that caching works.
So these standards can help most sites that use caching.
Batcache is the full-page caching system that WordPress VIP sites use.
After a set number of requests for the same page, it saves a copy and serves it to new visitors.
It requires your code to use:
Core WP Functions and APIs
For example, it won’t work with:
- URL queries strings
- Queries in
- Direct database queries
- Custom cookies
URL query strings or
$_GET parameters will disable caching.
WordPress VIP doesn’t allow them.
Prefer rewrite rules instead.
You can ensure that your rewrite rules are used by installing the Debug Bar plugin.
I also use the Debug Bar Extender, but you don’t need it for this.
Click the red “Debug” button at the top of any page, and click “Request” on the left.
You’ll see if the site used a rewrite rule.
Direct Database Queries
Few WP developers write their own SQL.
$wpdb usage won’t be cached.
This shouldn’t be needed, as long as you avoid creating your own database tables.
Visitors with cookies won’t get cached pages.
setcookies() isn’t allowed.
This page is never cached.
So it has to be fast. Try to limit its queries.
My 404 page lists all of the pages on my site, and the most recent articles.
But a VIP site couldn’t list all of its pages.
The uncached database queries could crash its servers.
The VIP Documentation lists all uncached functions, and suggests alternatives.
Counting posts with
post_meta, or comments with
- Is inaccurate due to caching
- Will cause performance issues
These VIP coding standards can help any size site with caching.
And using core WP functions is always recommended.
…whether you’re caching or not.
What’s your approach to caching?
Do you use Batcache, or another system?