How Do You Improve Performance in WordPress

By August 28, 2015 Wordpress No Comments
Performance Improvement on the Mechanism of Metal Gears.

If you need a quick fix now, go straight to the Caching section, you’ll get the biggest benefit for the smallest hassle there.

Optimizing Your WordPress Configuration

Minimizing Plugins

The first and easiest way to improve WordPress performance is plugins. Deactivate and delete any unnecessary plugins. Try selectively disabling plugins to measure server performance. Is one of your plugins significantly affecting your site’s performance?

Then you can look at optimizing plugins. Are plugins coded inefficiently? Do they repeat unnecessary database queries? WordPress has its own caching system, so generally speaking, using functions like get_option(), update_option() and so on will be faster than writing SQL.


After plugins come theme optimization.

  • Image Files
    • Are there any unnecessary images? (e.g. Can you replace some of the images with text?)
    • Make sure all image files are optimized. Choose the correct format (JPG/PNG/GIF) for the type of image.
    • and WP plugin can also help.
  • Total File Number/Size
    • Can you reduce the number of files needed to display the average page on your site?
    • Combine multiple CSS files into a single, optimized file.
    • Minify CSS and JavaScript files.
    • If necessary, look into plugins to help this process (e.g. Head Cleaner and WP Minify).
  • Query Reduction/Optimization
    • Can static values be hardcoded into your themes? This will mean you have to edit code every time you make changes, but for generally static areas, this can be a good trade off.
      • For example, your site charset, site title, and so on.
      • Can you hardcode menus that rarely change? Avoiding functions like wp_list_pages() for example.

We have seen themes which put 3x extra load to the server. Turned out it caused 3x more database queries – which is bad in itself. Then we found out that some of the queries are unoptimized. Not good.

You can also use offloading to optimize your theme.

Let Someone Else Do It

Using a Managed Hosting solution such as, or WPEngine takes advantage of the hard work and expertise of service providers to do the heavy lifting of optimization for you.

Upgrade Hardware

Paying more for higher service levels at your hosting provider can be very effective. Increasing memory (RAM) or switching to a host with Solid State Drives (SSD) e.g. Digital Ocean can make a big difference. Increased number of processors and processor speed will also help.

Optimize Software

Make sure you are running the latest operating system version e.g. Linux, Windows and the latest web server e.g. Apache, database e.g. MySQL server and PHP.

DNS: Don’t run a DNS on your WordPress server. Use a commercial service for DNS such as Amazon’s Route 53 or your domain registrar’s free offering. Using a service such as Amazon can also make switching between backup servers during maintenance or emergencies much easier. It also provides a degree of fault tolerance. If you host your DNS on external servers this will reduce the load on your primary web server. It’s a simple change, but it will offload some traffic and cpu load.

Web Server: Your web server can be configured to increase performance. There are a range of techniques from web server caching to setting cache headers to reduce load per visitor. Search for your specific web server optimizations (for example, search for “apache optimization” for more info). Some web servers have higher speed versions you can pay for such as Apache Litespeed. There are also a number of ways to tune Apache for higher performance based on your particular hosting and site configuration, e.g. Memcache.

PHP: There are various PHP accelerators available which can dramatically improve performance of your PHP files. This will apply to all PHP files, not just your WordPress installation. Search for PHP optimization for more information, f.e. APC. The W3 Total Cache plugin, described below, offers integrated support for Memcache, APC and other Opcode caching.

MySQL: MySQL optimization is a black art in itself. A few simple changes to the query cache settings can have a dramatic effect on WordPress performance because WordPress repeats a lot of queries on every request. Search for mysql optimization for more.

A great example of how WordPress has been optimized was presented by Iliya Polihronov at WordCamp San Francisco 2012. Iliya, among other things, does server optimization for

Don’t run a mail server on your WordPress server. For your contact form, use something like Contact Form 7 with free Mailgun.


Caching Plugins

Plugins like W3 Total Cache or WP Super Cache can be easily installed and will cache your WordPress posts and pages as static files. These static files are then served to users, reducing the processing load on the server. This can improve performance several hundred times over for fairly static pages.

When combined with a system level page cache such as Varnish, this can be quite powerful. If your posts/pages have a lot of dynamic content configuring caching can be more complex.

W3 Total Cache

W3 Total Cache (W3TC) is the latest generation in WordPress performance plugins, combining the research of web development authorities to provide an optimal user experience for WordPress sites. These detailed guides walk you through

W3TC is unique in its ability to optimize server side and client side performance, adding functionality otherwise unavailable natively:

  • Page Caching: W3TC helps to decrease response time by creating static HTML versions of pages, allowing web servers to serve them without invoking PHP. It automatically updates the cache when comments are made or pages are edited.
  • Minification: Removes unnecessary characters from HTML, CSS and JavaScript files, then respectively combines them before applying HTTP compression on the cached files.
  • Database Caching: Database queries (objects) are also cached, allowing many sites to reduce the time needed to generate new pages. This is especially useful for sites that receive a lot of comments.
  • Headers: W3TC manages the headers (entity tag, cache-control, expires) which control the caching of files in web browsers, reducing server load and improving the user’s perceived performance.
  • Content Delivery Network (CDN): Using a CDN allows you to Offloading resources from your hosting account. W3TC moves the requests for images, CSS, JavaScript and other static files to a network of high performance servers. The server closest to the visitor is automatically used to download the files, providing the fastest downloads possible.

W3TC can be used to optimize WordPress in both single- and multi-server environments through either shared or dedicated hosting.

WP Super Cache

WP Super Cache is a static page caching plugin for WordPress. It generates HTML files that are served directly by Apache without processing comparatively heavy PHP scripts, helping you to make significant speed gains on your WordPress blog.

WP Super Cache is a fork of WP Cache by Ricardo Galli Granada. WP Cache also caches your WordPress blog pages and delivers them without accessing the database. However, its use is no longer recommended, as WP Cache still needs the PHP engine to be loaded in order to serve the cached files.

However, WP Super Cache gets around this problem, allowing HTML files to be generated and served without ever invoking a single line of PHP. Using WP Super Cache allows your server to serve cached HTML pages at the same speed it serves regular graphic files. Consider WP Super Cache if your site is struggling to cope with its daily number of visitors, or if it appears on, or any other popular site.

Server-side Caching

Web server caching’ is more complex but is used in very high traffic sites. A wide range of options are available, beyond the scope of this article. The simplest solutions start with the server caching locally while more complex and involved systems may use multiple caching servers (also known as reverse proxy servers) “in front” of web servers where the WordPress application is actually running. Adding an opcode cache like Alternative PHP Cache (APC) to your server will improve PHP’s performance by many times.

Varnish Cache works in concert with W3 Total Cache to store pre-built pages in memory and serve them quickly without requiring execution of the Apache, PHP, WordPress stack.

As described within, using a plugin for comments such as Disqus instead of native WordPress comments can assist Varnish by not requiring your readers to login to WordPress and increasing the number of page views that Varnish can serve out of the cache.

Browser Caching

Browser caching can help to reduce server load by reducing the number of requests per page. For example, by setting the correct file headers on files that don’t change (static files like images, CSS, JavaScript etc) browsers will then cache these files on the user’s computer. This technique allows the browser to check to see if files have changed, instead of simply requesting them. The result is your web server can answer many more 304 responses, confirming that a file is unchanged, instead of 200 responses, which require the file to be sent.

Look into HTTP Cache-Control (specifically max-age) and Expires headers, as well as Entity Tags for more information.

W3 Total Cache integrates support for browser caching and ETags.