YARPP is a great WordPress plugin and I use it whenever related posts functionality is required on a WordPress website. The plugin has its own caching mechanism which improves performance most of the time. Sometimes, however, it can cause a lot of performance issues, especially when used with other object caching plugins such as Hyper Cache, WP Super Cache, W3 Total Cache.

Hyper Cache and YARPP weren’t playing nicely for me on Contest Watchers and I decided to look for a way to modify or completely disable the YARPP cache.

Going though the source in /wp-content/plugins/yet-another-related-posts-plugin/yarpp.php I discovered that the type of YARPP cache is defined through the YARPP_CACHE_TYPE constant. By default YARPP creates a separate database table where it keeps its cache results. Alternatively it can be made to process its results whenever a post is loaded, though the post metadata.

Since v3.2: YARPP uses it own cache engine, which uses custom db tables by default.
Use postmeta instead to avoid custom tables by un-commenting postmeta line and comment out the tables one.

If you want to try the alternative setting and see if you gain some performance on your site, all you have to do is set the YARPP_CACHE_TYPE constant to ‘postmeta‘, before YARPP defines it. To do that, you’ll need to add the following code in wp-config.php, right before wp-settings.php gets required:

// Bypass YARPP cache to improve performance
if ( ! defined ( 'YARPP_CACHE_TYPE' ) ) {
define ( 'YARPP_CACHE_TYPE', 'postmeta' );
}

And that’s it! Now do some browsing through your website and see if you can notice any difference. You can get a lot of help from Query Monitor while doing that.

If you’re happy with the results, you might also want to delete the cw_yarpp_related_cache table from your database, to clean things up.