Tips / Nginx

20 ways to Optimize WordPress Performance

There are many ways to improve wordpress performance and speed, and since I’ve been using WordPress for many years, on this posts I will share my best 20 tips to Optimize WordPress Performance. Some of this are simple and some others require more time and tech knowledge. Let’s begin.

Wordpress Performance

How to Optimize WordPress Performance

1) Keep WordPress Up to date: having your software updated is one of the best tips you will ever need. Latest versions offer you the best security to your apps, fixed bugs and stability above all. You can update your WordPress from WP Admin – Dashboard – Updates using your FTP access data. Be sure to make a Backup of your files before running the update process, just in case.

2) Update your plugins and themes: having your WordPress core updated is not enough, you will also need to keep your plugins and themes files updated for the same reason: security and stability. You can update your WordPress plugins and themes from WordPress admin page – Dashboard – Updates. Backup your files before the update.

3) Cache is a must! It can sound pretty obvious but you will get really surprised to know how many sites do not have any cache system installed on their WordPress blogs. A cache system is useful to improve WordPress performance, as it will cache the most common operations done by WordPress at PHP and MySQL level, reducing the load time and the server resource usage. Two of the best plugins I’ve tested so far are W3 Total Cache and WP Super Cache.

4) Lightweight Themes: design is also important, but if you overload your theme with many objects it can really harm your WP performance. Keep it pretty but lightweight at the same time, reduce the number of elements it loads. Remember that “content is king”, your visitors landed on your site because they are interested in the information you published, so it is always better to have a minimalistic and fast wordpress theme than having a very slow theme that looks nice.

5) Use a CDN: content delivery networks are one of the best things done in the past decade in the webhosting world, and you can get advantage of that if you use it correctly. If you have installed W3 Total Cache or WP Super Cache plugins, you will be able to completely integrate a CDN service with your WordPress blog in the easiest way. I won’t recommend free CDN services, just the paid ones I’ve used so far: Akamai Exceda CDN service (the best one I’ve found in terms of performance, pops around the World and pricing), and MaxCDN (doesn’t have so many pops like Exceda and it is only useful only if you have traffic in the US, they don’t have many pops in EU or SouthAmerica).

6) Index Optimizaton: this tip includes a few micro tips to optimize the load time of your index file, which is in most cases the most important page of your website. Some things to keep in mind:

  • Don’t show full posts on the index to allow duplicate content and improve WP speed, instead of full posts use excerpts, you can configure this with plugins like Auto Excerpt everywhere.
  • Reduce the number of posts you show on the index, I will suggest max 8 posts. This is configurable from “Settings – Reading – Blog pages show at most”.
  • Remove as many Widgets as you can, it doesn’t have any sense to have your index overloaded with sidebards and stuff and have almost no space to show your content, which is the most important thing you want to show to your visitors.

7) Minify your code: plugins like WP Minify or Autoptimize will help you to reduce the size of your CSS, JS (javascript) and the HTML code of your blog, which will dramatically increase your WordPress speed and at the same time will reduce the bandwidth used by your website. Alternatively, you can Minify your files manually using online tools like:


8) Defer parsing of Javascript: what if you move the JS code to the end of your page, so that way the HTML and CSS code will load first and faster with no delay waiting for your JS code. This kind of optimizations can be done using plugins like WP Defer Loading and WP Deferred Javascripts.

9) MySQL database optimization: most developers and website owners forget about this important tip. You must optimize your database data at least once per month, this will help the MySQL queries to find the correct information in leass time as your data will be organized better. You can do this with  phpmyadmin tool, or with plugins like WP-DBManager, that will also let you repair, verifyt and backup MySQL tables.

10) Image Optimization:  make sure every image you upload are 100% optimized with the correct format (GIF, JPEG or PNG). You can do this manually using Photoshop, Gimp or another image processing tool. You can also integrate the great WP Smush it plugin, that will do all the optimizations automatically to each image you upload. Also remember to avoid lot of images per posts, or big galleries.

11) Load images on demand: using plugins like Lazy Load or BJ Lazy Load will change the way your images are loaded on each post. This kind of plugins will load the images on demand, that means the images you see are only loaded when are visible to your eyes. This will make your website pretty much faster if you load many images per post or in your index.

12) Don’t use gravatars: are they really useful? In my opinion, this kind of things are not useful at all for your blog and only add extra time to your page load. You can remove the  use of gravatars from WP admin page – Settings – Discussion.

13) Don’t use too many plugins: this is ironic since in the past tips I’ve recommended you so many plugins and now I am telling you to don’t do that. The thing is almost all the tips provided before can be done manually, but it will take you lot of time and PHP-MySQL knowledge, if you don’t have that knowledge (as most of 80% of the people that use WordPress), you don’t have any other way to do it than using Plugins. You can use plugins, but remember to keep it to the minimum. I’ve seen WordPress websites with 50 plugins activated and the performance is horrible. Try to have at most 10-15 plugins activated, no more than that.

You can use P3 (Plugin Performance Profiler) to analyze which plugins are causing slow speeds on your blog.

14) Use Gzip Compression:   it will help tou to compress the static content (JS, CSS and HTML) to be served faster and using less bandwidth. You can activate Gzip compression by adding this code to your .htaccess file:

# Start gzip compression
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# End Gzip compression

If you use Nginx place this code inside your http {} block:

# Start Gzip compression
gzip on;
gzip_min_length  1100;
gzip_buffers  4 32k;
gzip_types    text/plain application/x-javascript text/xml text/css;
gzip_vary on;
# End Gzip Compression

Reload Nginx to apply changes:

/etc/init.d/nginx reload

You can read more about Gzip and Nginx from: Nginx Gzip compression

15) Leverage Browser Cache: you can let your browser visitor cache the most common static elements from your website, that will result in faster WordPress speeds as the static files (CSS, JS, image files, mp4, swf, etc) will be cached on your visitors PC for the time you specify. If you use Apache you can place this code inside your .htaccess file.

# Browser caching
<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 application/pdf "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
# End Browser caching

If you use Nginx, you can place this code inside the http {}, server {} or location {} blocks, example:

location ~* .(jpg|jpeg|png|gif|ico|css|js)$ {
expires 365d; 

Reload Nginx to apply the changes:

/etc/init.d/nginx reload

Nginx users can read more on this post: How to enable Browser Cache Static Files on Nginx

16) Use your own Cloud VPS or Dedicated Server: if you have more than 5000 visitos per day, the best you can do is to get a Cloud VPS server, with at least 2 CPU, 4 GB RAM and the disk space you use. If you have at least 10000 visitors per day, you may need to go for a Dedicated server with 4 CPU, 4 GB RAM. On both (VPS and Dedicated) make sure you have SSD (solid state drives) and not old SATA HDD, which are really slower. SSD disks are 10 times faster than SATA disks, and are specially useful for PHP-MySQL performance.

Having your blog running on a dedicated enviroment will bring you security, more stability and also more scalability than running the website on a shared hosting plan as you will be able to use Nginx, Varnish, PHP-FPM, MariaDB and Memcached, which are not usually available on 99% of shared web hosting providers.

Finally, make sure your VPS or Dedicated is 100% managed by your Hosting provider so you only have to worry about your WordPress and not about the technicall & network stuff to manage your server optimization and security.

Having said that, this are my options when it comes to VPS and Dedicated hosting providers:

  • A Small Orange
  • A2 Hosting


17) Use a Professional Hosting Company: don’t purchase Hosting on cheap/popular hosting providers like Godaddy, BlueHost, Dreamhost and that kind agressive marketing hosting  companies. In my experience, this companies only care about getting massive users and not about bringing a good hosting service. They usually don’t have good technical support, and that is crucial when you have problems with your website or server.

Host your WordPress on a serious company, with a good technical team with real 24×7 support (you can test this by calling them at midnight or early in the morning on weekends), that can help you in bad times and in good times. A good company will also help you to keep your server secured and stable.

I can recommend you a few providers if you are serious about hosting your WordPress on a professional hosting company:


18) Cloudflare: is a global CDN, performance and security company that will help you to optimize your WordPress website in global terms as it includes many cool features like CDN, Minify, and others that we’ve mentioned before. However, keep in mind that Cloudflare is not good for all websites. In my case I only use it to host my DNS servers, as their DNS server is one of the fastest DNS services in the world. Check it out at

19) Newrelic: this service will help you to analyze and understand how your blog is performing and give you advises on how to improve your WP performance. There are free and premium services. Read more at Newrelic WordPress page.

20) Analyze your website: PageSpeed & Gtmetrix are surely the best tools to analyze the performance of your website and will help you to understand why it is slow, and give you tips on how to fix it.

If you follow this 20 easy steps at this point I’m totally sure your WP blogs will run faster than light! Remember that a good website speed is one of the most important factors in SEO and also a very good way to improve your e-commerce sales.

Popular search terms:

  • wordpress nginx optimization
  • centos wordpress optimization
  • wordpress performance optimization
  • wordpress optimization

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking