How to Optimize Your WordPress Site for performance

How to Optimize Your WordPress Site for performance


At VBHOSTNET, all hosting plan comes with its own resource to ensure fair usage and stability on the server and this limits per user depending on the hosting package you purchase will be displayed on your cpanel for reference.


It comes a time when your wordpress site may constantly exceed the limits especially hose hosting on vbasic hosting package and thus an upgrade may be need in other to get more CPU, RAM and other resource but before you may want to consider upgrading your package as an option, focus on optimizing your blog may and have proving to be helpful.


Today, I would like to share with you some quick tips on how you can optimize your wordpess website and decrease page loading times and memory spike probelm. If you follow these techniques and best practices, your website will load much quicker.


Before applying these techniques to your website, I encourage you to check the speed of your website using a free performance service such as GTMetrix, YSlow or Google PageSpeed Insights. These services will inform you of your page loading time and the overall file size of your page. They also offer tips


1. Choose the Right Hosting Plan


The first step in optimizing your website correctly is to choose the right hosting plan. You are fighting a losing battle if your server is taking an age to process HTTP requests, High CPU consumption, memory and MySQL commands.


Performance services such as GTMetrix will advise you of the exact response time of your server. I recommend testing the response time of your own website against similar websites. For example, if you run a news blog, see how your server response time compares to other news blogs within your niche.


Hosting server may  not always the cause as all our servers are using very powerful hardware and optimized to cater for your hosting needs. You may be with a great hosting company but see poor response times because your chosen hosting plan is underpowered. As a recommendation vStandard or vAdvanced hosing package is the best choice for Wordpress, though vBasic is good but with time may not be able to handle high demand from your web site. Our premium web hosting is crafted to handle really massive traffic and resource consuption.


However, any type of hosting plan will suffer from insufficient RAM and CPU throttling. Therefore, you need to pay attention to what your website needs to run smoothly.


2. Fast WordPress Theme will save a Lot


Often times choosing the right wordpres them can save a lot of trouble  as a them design that has been coded badly, or uses images poorly throughout the design, will add unnecessary weight to your page. It is not uncommon for some WordPress themes to be a few megabytes in size. Such a design could add a few seconds to your page loading time.


Choose a design that has been optimized for desktops, tablets and mobile devices. Search engines favor responsive designs as they ensure all pages have the same URL, however adaptive designs that were created specifically for mobile phones can improve a mobile user’s experience considerably


In This case trying a couple of different themes to see if your server load reduced can be worth the while.


3. Empty Your Trash


WordPress 2.9 introduced the WordPress trash system. Whenever content is deleted, be it a comment, post, page, media etc; it is sent to trash. From here, the content can either be restored or deleted permanently. It is effectively a fail-safe system that helps you recover anything that was deleted accidentally (in much the same way the recycling bin works in your computer).


Trash can take up a lot of unnecessary room in your website’s database. The bigger the database, the longer it is to retrieve information from it.


By default, WordPress will automatically delete trash after thirty days. This can be reduced by modifying the wp-config.php file. For example, you could reduce this to seven days by adding the following:

define ('EMPTY_TRASH_DAYS', 7);


You can completely disable the trash system by adding this to your wp-config.php file.

define ('EMPTY_TRASH_DAYS', 0);



4. Be careful with Plugins


Plugins are one of the biggest causes of WordPress high resource consumptions. The more plugins you install without control, the more likely you will face performance issues; however the sheer number of Plugins you have installed is not the reason a WordPress website can slow down.


Certain plugins are known for causing websites to be slow the reason been that they may be badly written. There are many reasons for this including bad coding, calls to external servers and persistent calls and updating of your WordPress database. Pay close attention to how much CPU plugins use too. Many plugins can bottleneck your CPU due to persistent processes. If this happens, the whole web site could go down.


One plugin I highly recommend you use is P3 Profiler. Developed by GoDaddy, the plugin will show you exactly how much load time your plugins are adding. A breakdown is given which displays exactly how much load each plugin adds. It is the most effective way of seeing what plugins are slowing down your website.


5. Enable Gzip Compression


Gzip compression allows a website page to be transferred to a browser at up to 70% of its original size. The browser will then decompress the page and display it to the user.

Gzip can be enabled via the WordPress options page. Simply add the code below to your .htaccess file...


<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

The check if Gzip is working using this site


5. Reduce Post Revisions, Spam, Drafts, Trackbacks and Pingbacks


Trash alone is not the only thing that can increase the size of your database. Others such as post types populate table rows with data. Essentially, it is important to regularly delete spam comments and unwanted pingbacks and trackbacks and if possible disable commends


You should also be careful with the number of drafts and post revisions your website has stored. The WordPress revision system allows you to go back to older versions of articles view them and restore them.


Post Revisions


Post revisions can greatly increase the size of your database.


By default, WordPress will save an unlimited number of revisions, however this is generally not needed. It is better to reduce this limit to something more practical such as two or three. You can do this by adding the following code to your wp-config.php file:

define( 'WP_POST_REVISIONS', 3 );


Alternatively, you can completely disable the post revision system by adding the code below to your wp-config.php file. From a blogger’s perspective, this is not an optimal set up as post revisions are very useful, however many website owners have taken this step to ensure their database runs more efficiently.

define( 'WP_POST_REVISIONS', false );


A more practical way of cleaning your WordPress database is to use WP Optimize. The plugin can automatically remove auto-drafts, spam comments, trackbacks and e.t.c. WP-DBManager is also a very good solution for optimizing your entire database.


6. Optimize Images for the Web


Just uploading pictures without the proper web standard (72 to 96DPI) can make a web site run slow. Images can help break up long pieces of text and can help your articles be shared more frequently on social media services; however they also take up a lot of storage if not optimized. Hence, pages that contain more images can take a long time to load.


It is therefore in your best interests to optimize your images for the internet before you upload them to your website. Most photo editing applications, such as Fireworks, Photoshop, allow you to do this via the “Save for Web” option when exporting. Note you will not get the options when you save directly.


An image optimization plugin can also be employed and a good plugin for the job is  WP It utilizes the Smush .it API to optimize JPEG images, strip meta data from JPEGs and convert GIF images to PNG. You should however be aware that the plugin uses up a lot of resources when it is converting images, therefore your website may be slow while it is running.


If you do not want to sacrifice image quality, check out Lazy Load. The plugin ensures that images are only loaded when the area becomes visible to the user. This will greatly reduce page loading times.


7. Consider Not Using Official Social Media Buttons & Widgets


For most website owners, social media traffic is second only to search engine traffic. Which is why social media sharing buttons are so prominent on website designs.


Official sharing buttons are popular as they denote the number of shares a page has had. Unfortunately, official sharing buttons from services such as Facebook and Twitter can increase loading times immensely due to the calls they make to external services. I previously displayed sharing buttons above and below articles for Facebook, Google+ and Twitter. This added a whopping 500KB to my pages.


By simply changing to text links or locally stored social media images, you could save reduce your page size by up to one megabyte.



8. Enable Browser Caching


Some of the largest files on your website rarely change. This includes CSS files, Javascript files, your website logo etc. One way to take advantage of this is to enable browser caching.


Browser caching allows internet users to speed up the loading time of their favourite websites by storing a cached copy of your website locally. This reduces calls to your server and saves the user from downloading the same files again.


You can enable browser caching by adding the following code to your .htaccess file:


<IfModule mod_expires.c>

ExpiresActive On

ExpiresByType image/jpg "access 1 year"

ExpiresByType image/jpeg "access 1 year"

ExpiresByType image/gif "access 1 year"

ExpiresByType image/png "access 1 year"

ExpiresByType text/css "access 1 month"

ExpiresByType text/html "access 1 month"

ExpiresByType application/pdf "access 1 month"

ExpiresByType text/x-javascript "access 1 month"

ExpiresByType application/x-shockwave-flash "access 1 month"

ExpiresByType image/x-icon "access 1 year"

ExpiresDefault "access 1 month"




The code above specifies how long a particular file type should be stored. Files will simply be downloaded again if they have expired.


9. Install a Cache Plugin


Caching plugins allow you to publish static HTML files instead of dynamic files. This greatly reduces the time a page takes to load as there are no PHP or MySQL commands to execute.


Additional caching features include minification, caching of feeds, Gzipping, Content Delivery Network (CDN) support, and much more.


Caching your pages is one of the most effective ways of improving your page loading times, with many plugins promising an improvement of at least ten times. Popular caching plugins include WP Super Cache, W3 Total Cache and WP Fastest Cache. All three plugins are available free.


10. Use a Content Delivery Network


Your website is hosted in a data center somewhere in the world. The further a visitor is from the location of your data center, the longer it takes for your web pages to load.


Content Delivery Networks (CDN) addresses this issue by utilizing dozens of data centers around the world. They take the heavy work away from the server by hosting your images, CSS and Javascript files, and serving these files to visitors from the closest location to them. Seconds can be taken away from your page loading times because of this.


Popular content delivery networks include MaxCDN, Amazon CloudFront and CloudFlare. The cost of these services vary according to how much bandwidth your website uses. CloudFlare is available for free from your cPanel, yon follow details here to install it



Finally if you have employed most of the tips here and still your web site is not giving the desired performance, I think it is time to upgrade to a higher package

  • 14 Users Found This Useful
Was this answer helpful?