Akismet is a WordPress plugin for dealing with comment spam. It’s pretty good and simple to set up:
- Sign up for an Akismet plan (from free for a personal site, to $50 per month for enterprise).
- Use the API key generated to activate your plugin.
The API key (like a license key) is in the format abcde1f23456.
And that’s fine if you have only one site, but if you’re running WordPress multisite then you don’t want to have to activate Akismet individually for each sub-site. That’s just tedious.
Wouldn’t it be much better if you could just add the API key once?
Akismet doesn’t offer that option within the user interface on Multisite. Undeterred, I went in search of a way to do it.
How to do it
The wonderful folks over at WPMU DEV have a really useful blog post from July 2013 about how to do this: How to use Akismet on WordPress Multisite with 1 license key.
The good news it’s really simple:
- Open wp-config.php in your favourite text editor.
- The WPMU DEV article recommends that you add the API code below the comment /* That's all, stop editing! Happy blogging. */ but I prefer to add it below the define() block for Multisite. But you can add it where you like, really.
- Add the following code define('WPCOM_API_KEY','abcde1f23456');
- Save wp-config.php and upload it to your site.
Your wp-config.php file will then look something like this:
/** Multisite */
define('WP_ALLOW_MULTISITE', true );
/** Define WordPress.com API key for Akismet in WordPress Multisite */
Like many things on this blog I’ve added this here primarily for my own reference, but I hope it helps you too.
The real credit on how to do this, of course, goes to Sarah Gooding from WPMU DEV: thank you.
Happy spam-free blogging!