Using WP-Super Cache plugin with WordPress MU

Using the WP-Super Cache plugin with WordPress-MU is very simple.

WP Super Cache is a static caching plugin for WordPress. It generates html files that are served directly by Apache without processing comparatively heavy PHP scripts. By using this plugin you will speed up your WordPress blog significantly.

Instructions on how to install the plugin can be found in the readme file that comes with the plugin. As noted in the file, installing the plugin for WordPress-Mu differs just a bit from the regular WordPress install:

If you are using WordPress MU you will need to install this in ‘wp-content/mu-plugins/wp-super-cache/’ and the file wp-cache.php must be copied into the mu-plugins directory.

But there is a small problem with the plugin that I find very annoying. Although the cache is cleared with every post update and every theme change, when a user updates his blog’s widget settings the cache is not cleared and the user will not have a clue what is going on. This will result in a flood of support tickets.

I have been trying to solve this issue without changing any core files but came short. Finally I edited the wp-admin/widgets.php file and added just after line 266 the following code:

// Added to clear WP-Super Cache after the widgets are updated.
// Code by Elad Salomons http://www.ringofblogs.com
if(function_exists('wp_cache_no_postid')) {
wp_cache_no_postid(0);
}

If someone finds a way to use a plugin for this please let me know. By the way, this should work just the same for the regular WordPress.

Did you find this post interesting? Please subscribe to my feed.

Comments 2

  1. Ben Chun wrote:

    In the newest version of WPMU (2.6.2), the widgets.php code has been updated considerably and now I think the thing to do would be hook wp_set_sidebars_widgets. Unfortunately this is not a pluggable function, nor is it set up as a hook. (Note that wp_set_sidebars_widgets is called from a few places within wp-admin/widgets.php but is defined in wp-includes/widgets.php so that’s the place to clear the cache.)

    I added your code after line 367 in wp-includes/widgets.php and it works.

    Posted 26 Oct 2008 at 10:45 pm
  2. Joe wrote:

    Hi,

    How to enable plugins by default so users won’t have to manually activate the plugins from their wp admin page?

    Thanks

    Posted 18 Dec 2010 at 9:32 am

Post a Comment

Your email is never published nor shared. Required fields are marked *