Running WordPress in production - Security and Speed
28th Nov 2017
WordPress gets a fair share of bad press.
Most of this bad press is centred around security concerns. Many of these concerns are valid, but need not be a concern of yours if you are intending to run WordPress in production. You just need to a responsible webmaster. In this post I'll list out some tips that will make your WordPress install robust and fast.
1. Keep your Wordpress Install up to date
This is the most important security concern that you need to have. WordPress even makes updating your install super easy. You don't need to log into any servers, you just need to login to the admin tool and head over to the dedicated updates page. From there you can simply press a button to get all of your pluggins and WordPress itself updated. Once your install is fully updated, you'll see a nice clean page like this, telling you that there is nothing to update:
WordPress update screen telling me I'm fully updated
In the same way that you keep your laptop or PC up to date, you should be keeping your WordPress install up to date.
2. Install WordFence
WordFence is a popular security plugin that will offer you some protection against trending attacks. It's a plugin that you should install, but it does not absolve you of all of your security responsibilities. You should still be regularly updating your server's OS and any libraries installed on it.
3. Use Askimet
Askimet is a very popular WordPress plugin that is essential if you allow commenting on your website through WordPress. Askiment will block shedloads of spam posts to your site, and you won't even need to look t them. I don't trust 3rd party services like disqus, so this was an essential plugin for me.
4. Back your shit up
WordPress has a few moving parts. Some of those parts are held in files, others in a MySQL database. You could periodically back these two up manually, or you could take advantage of one of the great WordPress plugins that you can use to automate your backups and make it super easy. An excellent one is Updraft Plus. This plugin can be set to regularly backup your entire WordPress site and can even store the backups in a cloud file service like Dropbox.
5. Install a caching plugin
A cache plugin will improve the load speed of your site. It will save database calls, and will instead pull data directly from memory. A popular plugin is WP Super Cache. And remember, a quick load time can mean that search engines rank you higher, and your visitors will love you.
6. Install an image compressing plugin
Again, this will give you a speed advantage and will save on your bandwidth use. A popular plugin is WP Smush. This plugin can be set to batch compress all images in your site, and can be used to compress images as and when they are added to your site.
7. Minify your JavaScript and CSS
Depending on how you've built your WordPress site will affect how you do this. If you have customised your WordPress templates or made your own theme, you should introduce a step in your build process to bundle and minify your JS and CSS.
If you are just using a 3rd party theme that you haven't customised a lot, you should grab a plugin to bundle and minify your JavaScript and CSS. A plugin that I've had some success with is Better WordPress Minify. You may have to tweak it's settings slightly to make sure it doesn't break any of your other plugins that are rendered out on the UI (e.g. a source code highlighter plugin).
8. Use the latest version of jQuery
The standard install of WordPress doesn't use the latest version of jQuery. Depending on the user's that you'd like support, you may want to update to the latest version of jQuery. You can do this in your build process, or you can do this with a plugin, like jQuery updater.