WordPress VIP Caching

By: Ryan Kienstra on: January 5, 2015  in: WordPress VIP

WordPress VIP cachingMany 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 $_GET
  • Direct database queries
  • Custom cookies

URL Queries

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.

Request Rewrite Rule

Direct Database Queries

Few WP developers write their own SQL.

But even $wpdb usage won’t be cached.

This shouldn’t be needed, as long as you avoid creating your own database tables.


For user-level interactions, prefer JavaScript to cookies.

Visitors with cookies won’t get cached pages.

Even setcookies() isn’t allowed.

404 Page

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.

Uncached Functions

These include:

  • get_posts()
  • get_children()
  • wp_get_recent_posts()
  • get_page_by_title()
  • wp_get_post_categories()

The VIP Documentation lists all uncached functions, and suggests alternatives.

“Meta” Functions

Counting posts with post_meta, or comments with comment_meta

  • Is inaccurate due to caching
  • Will cause performance issues

Wide Application

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?

Leave a comment