Founder of Suncoast Web Solutions

Neil McNulty

Subscribe to Neil McNulty: eMailAlertsEmail Alerts
Get Neil McNulty: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

Optimizing a WordPress website for better performance

The topic of Optimizing a WordPress website for better performance is one that comes with so many ideals and so many misleading results when you carry out a search in your favourite search engine. Infact if you do a search for “how to increase speed of wordpress site” you will find that there is over 8,000,000 results in Google for example.

Keeping in mind that while that is not a huge result you can almost guarantee that a lot of the options for optimizing WordPress is almost endless. There is however a few great simple things that you can do to help make a difference with your WordPress website load times.

Your Website Hosting

Probably one of the most popular misconceptions in the marketplace with websites is the hosting environment. People are lead to believe that if they pay next to nothing for their website hosting it is not going to be any different to what they are getting now.

Unfortunately this is not true and not always the case. Fact is that most servers will come at a fairly heft cost to the hosting company, they then have to load them up to the max in order to get the best ROI on the machine and make money to pay support staff. The cost of this is their customers websites, the resources that each account is given and the backups that are taken etc along with overall support.

Best practice is to pay more for your hosting. If your website is for your business and you want to get the best possible results consider a VPS (Virtual Private Server). It will enable you to squeeze as much performance out of your website as possible.

Optimizing Your Website Hosting Environment

One of the first things that we always do when we have a customer wanting us to optimize their WordPress website is we deploy a custom htaccess file. A lot of website designers who believe they understand how WordPress runs will say something like “oh yea we do that already…”

The common misconception is that by enabling SEF url’s that is all the htaccess file does do for your site. This is not the case, it actually can handle a lot of cool things, including speeding up the load time of your site by carrying out some really great tasks.

Without going in to too much detail, we have added to the bottom of this article a link to download a copy of the htaccess file we utilize on all of our WordPress sites when asked to do website optimization. There is a more detailed explaination on what it does and how each element works in our article for optimizing your Joomla website.

To enable our custom htaccess file, upload it to your sites root folder, simply rename the wp-htaccess.txt to .htaccess through File Manager in CPanel/Plesk or through your ftp client.

To stop your site from crashing when you first rename the wp-htaccess.txt file to .htaccess we have placed hashtags (#) at the beginning of each line. This is just incase your hosting provider’s server configuration doesn’t support .htaccess files with PHP Values or PHP Flags in it.

To enable each customization remove the # from the start of the respective line, save it and then view the website in your browser to make sure it is still working. If an error shows up on the screen where the site isn’t loading (also commonly known as either a http 500 error or internal server error) then quickly go back to your .htaccess file and reinsert the # at the start of the line you just removed it from and save the change. This should return the site to a running state.

If you do get these errors for most of them then you need to contact your hosting provider for assistance and ask them how you can implement the items outlined in the htaccess file.

One change you will have to make yourself that is not something we can do is modify the line for “session.save_path”. Where it has the word “username” or “domainname” appear you will need to update it with the right value. For CPanel accounts you will need to update the “username” to the CPanel username. For Plesk accounts you will need to change “domainname” to your domainname.com.au.

Download our modified .htaccess file for your WordPress Website.

Themes

With a large selection of WordPress Theme stores in the marketplace choosing the right template can be difficult. One thing that makes it harder is finding one that is lightweight that can give you the design flexibility that you need.

There are also a lot of theme stores that tend to over offer what you will get with their template. By this we mean that they tend to add myriad of extra plugins that will help with different things, including editing content. It can lead to multiple requests to external servers for scripts and code to load when someone visits your website. It is a good idea to do some testing to see what ones do that before continuing with the site build if you are just at the beginning of your sites development.

One of the best things you can do is turn off or uninstall any additional plugins that you get with your theme that you do not require to have running.

On the flip side if you have a custom coded theme created for your WordPress website then you probably have a few great things already happening and the biggest one apart from the security benefits is that your theme is probably really lightweight.

To help with performance, make sure that you load all of the javascripts you can from the bottom of the page. To do help further with this make sure that your <script> tags have either “async” or “defer" tags included in them.

Plugins and Widgets

The WordPress community is without a doubt one of the largest, if not the largest, of its kind in the world. Millions of plugins and widgets are made each day with many more getting updates regularly. Take advantage of this and make sure that you keep the ones you install up to date.

There are lots of plugins and widgets that unfortunately request scripts and access to code from multiple external locations can cause site load time issues. After installing a plugin or widget do a test to see if your website’s load speed drops. If it does then chances are that it is calling an external script.

A great practice is to stick with popular extension developers as they will often provide great plugins and widgets that utilize lightweight javascripts, jquery, boostrap as well as other popular open source based solutions.

A few great plugins that we utilize regularly to help optimize customers websites include:

W3 Total Cache – This is one of the highest voted for performance plugins for WordPress today. It will help leverage browser, page, object and database caching. It will help minify CSS, Javascript and HTML as well as adding CDN (content delivery network) support. Seriously consider purchasing the premium version of this as it will not only give you some added features it will ensure that this product will continue to grow well in to the future.

WP Smush – This great tool can help reduce image file sizes using lossless compression techniques. You should purchase the premium version of this though as it will open up a lot more options for you.

WordPress Configuration

WordPress does offer a lot of simple and easy to understand settings that you can find throughout the Settings button in the admin section. One area though that it tends to hide is the manual options section. This hidden gem is located at yourwebsite.com.au/wp-admin/options.php.

Once you have accessed this page the one key setting you need to update is “can_compress_scripts” which should have its value changed to “1” from “0”. This will enable wordpress to compress each page further before it is sent to the visitors browser.

Some Good Practices With WordPress Based Websites

  1. Remove unused plugins and widgets. Often people will leave plugins they have got deactivated for no real reason. If they are deactivated simply remove them. You can always reinstall them later if you need them. This also applies to themes.
  2. If you can, avoid social sharing plugins. Yes it does go against a lot of advice out there in the world of SEO but fact is that they can adversely affect page load times and this is what this article is about.
  3. Do not modify any core WordPress code for any reason. It will only be wiped out when you update and frankly if you are modifying good code you could be making your WordPress core insecure.
  4. Do not custom code plugins or widgets that include multiple database requests (locally or externally), step through the process and work out what can be handled in the background with the use of crons etc.
  5. Keep WordPress and all your plugins up to date! This will hopefully ensure you have a safe, secure and fast loading WordPress website.

Conclusion

There are a lot of other things you can add/edit/remove when it comes to WordPress as it is not a polished product when it is released. It is designed this way so you can modify it and do with it what you like. The things we have listed really are the key things you need to look at in order to get your WordPress website performance increased.

If you have followed the guidelines above and have no success contact us today and one of our WordPress Specialists will be able to discuss how we can improve the websites performance in more detail.

Please note: Before we continue it is up to you to make a backup of your website before carrying out any changes outlined below.

Read the original blog entry...

More Stories By Neil McNulty

Neil is a Microsoft Certified Professional (MCP), but has an extensive knowledge of a wide variety of software, operating systems and web development processes.