February 22, 2012

Akismet, why it is awesome, and why you don’t need it

WordPress is a fantastic platform.  I use it almost exclusively as my CMS and blog of choice for myself and for my clients.    As it has matured the potential is really limitless as to what you can do with it.  But one of the things you might find once you delve into running your own WordPress site is that you quickly become a target for SPAM.

But have no fear, Akismet is here!   What is Akismet?  Well from the Akismet page you would find it described as such:

Automattic Kismet (Akismet for short) is a collaborative effort to make comment and trackback spam a non-issue and restore innocence to blogging, so you never have to worry about spam again.

Why is this important?  Well you don’t want your hard work to be tainted by spammers and bots.  It makes your site look trashy and if you keep it clean religiously then it just means extra work.  You should be writing not policing comments right?  And you don’t want to give spammers free publicity do you?

Well, the folks at Automattic (the authors of WordPress itself) have made this great little plugin available for free for non-commercial use.  So it goes without saying, you should use it because not only is it effective, it is 100% free in many cases.

But what if you are building a site that is a commercial venture?   Well thankfully they have drawn the line such that you only need a commercial license if you pull in more than $500/month from your blog.  To be honest, this doesn’t really make things clear for those that are building websites, not blogs (I will have to follow up with Automattic on this in the future).

Now don’t get me wrong, the $5/month they ask for a commercial license is totally worth it if you are pulling in that much scratch from your blog.  You will easily save yourself $5/month in headaches by using the service as it is very effective.

So why don’t you need it?  Well, as I said earlier, you most certainly should take advantage of it… but, only if you need it.

If you are using WordPress strictly as a CMS then you may not even want comments or trackbacks.  By default WordPress leaves these features on, so you might quickly find your site deluged with trackback and comment spam even on posts you never linked from your site… yeah those bots are that crafty.  The simple solution (if you don’t need these features) is to disable them.

To make your site spam-proof w/o Akismet head on over to your WordPress admin.

  1. Go to Settings
  2. Ensure next to the Membership heading the checkbox for “Anyone can register” is unchecked.  This means only people you create accounts for can login to the site.
  3. Go to the Settings->Discussion page
  4. Under “Default article settings” you can probably just uncheck all of these, though the most important ones here are the “

Now, you might be wondering… why is this necessary when WordPress by default requires you to approve comments and trackbacks?  Good question, well the reason for me is that I don’t ever want to have to pour over a list of spam and read each entry to determine if it is valid or not.  Depending on the traffic your site has this may or may not be an issue.

For my own blog I do allow both comments and trackbacks… but for my clients who are using WordPress strictly as a CMS I follow the directions above to ensure they don’t have to deal with the extra maintenance.

But if you do in fact use comments/trackbacks on your site, Akismet is invaluable.   Give it a try, you won’t be disappointed.

Moving to a new domain with WordPress

Changing domains with WordPress doesn’t have to be a headache.  You might think that simply updating your wp_options table in the database might be enough… or that perhaps you could do it in… you know, the wp-config file?  Well, you would be part right.  Changing your database values for ‘home’ and ‘siteurl’ are key to getting your site to work on a new domain… but before you mark this task is done, you might want to make sure your images will work once you switch off (if you intend to) the old domain.  See with each post image (images are saved as posts in the database) there is a GUID stored.  This has an absolute path to where the image resides and doesn’t rely upon your database settings.  So if you up and move your site off to another domain, you are going to want to update this as well.

Before we do anything, you have made a copy of your database, riiiiight?  Good.

You will want to get into PHPMyAdmin and run the following SQL:

UPDATE wp_posts SET guid = REPLACE (
guid,
'http://exampleoldsiteurl.com',
'http://examplenewsiteurl.com');

Of course this assumes you have used the default table name and you replace the URLs in the query with your actual domain names.

Now, this gets you a good bit of the way there… but you are STILL going to have bad paths if you kill off your old domain… this is because in your actual post content you are referencing absolute paths to your old domain.  Well depending on the scope of your site you can either edit each post/page manually… or do a find/replace in your database.  This would be best done before you import your database onto the new server.

So if we rewind a bit, you should have 1. backed up your database and 2. imported into your new site and 3. updated your settings.

To make things a bit easier for you on the migration, stop after you do your export… open up your SQL in a text editor and do a find/replace for your old URL and replace it with the new one.  Now that your SQL is clean, you should be able to do an import into the new database and all your links will work fine.  Since you are doing a replacement of all of your data, there shouldn’t be a need to follow up with the query above.

For more information check on the WordPress Codex page about migrating your site.