The performance of WordPress is a crucial factor for the success of your blog. Slowly blog is the enemy for visitors. So, it always needs to improve the performance to the top priority of modern optimization.

Check the previous part of this article series!

Optimize Database!

WordPress is a content management system (CMS) that written in PHP, and MySQL as its database management system so it uses a database as its brain for storing posts, pages, users, links, comments, menus, information, settings of themes and plugins, post content, metadata and user data, and a whole lot more, and all forms of textual and even the encrypted data. Almost everything is stored in the database. Without the database, there’s nothing works on WordPress. It’s like without a brain!

The optimized database runs faster than the unoptimized or large database. A small database doesn’t just only help for WordPress site performs faster and smooth for visitors, but also help the administrator, author, or editor write and update posts quickly.

At this point, I don’t want to write too long about clean up and optimize database so I recommend the fastest way to clean and optimize the database is using plugin! I have two recommended plugins are Optimize Database after Deleting Revisions (for who want to know more about using this plugin, go here!) and WP Sweep which help check, repair, fix and optimize your WordPress blog (check this post by Crunchify for using this plugin).

From Dynamics, Make Simple Static!

The dynamic page generated by WordPress is combined of PHP, Javascript, or Actionscript which produce different content for different visitors from the same source code file. E.g, The visitor requests to the server of the blog page, the server receives the request and starts process PHP, then WordPress contacted database, so the database transmitted and processed back to WordPress, and the compiler creates the finished blog page from the previously collected information. The last step, the result will appear in the user’s browser.

The static pages are designed with HTML and display the exact same content to all users. Truly, they don’t have to be simple plain text because HTML also can offer the style of text, and designs. They even can put multimedia such as photos, and videos, etc.

Usually, the browser always created the files called cache which stored the finished page results. But the cache stored only static content version, not dynamic version. That’s the advantage of static pages because it doesn’t have to download more data, as the blog page is simply saved as a complete package, but dynamic pages will need to download more data. So, a static page is very fast and causes less load to the server.

Install Caching Plugin!

Happily, it is very simple in WordPress to find a guarantee effective cache plugin. There are so many available plugins which are premium, freemium, or completely free.

My recommendations are surely here. For small sites, I recommend, the Cache Enabler as it is an undoubtedly caching plugin, which is effective and easy to use.

But for who needs more, say Hi to the professional cache plugin is WP Rocket. Indeed, the plugin is different from many competitors but it makes things much easier and provides excellent support, which is very helpful and worth for beginners or inexperienced users.

Setting Up Cache-Control Headers

For better understanding about browser cache! Here is an example, A user comes to your site. Then his computer or smartphone has to download many different images, CSS and Javascript files. And those files will use at the next time when he visits again without downloading all those images and other files because it’s already available in his cache.

The often forgotten secret weapon when it comes to caching is the Cache-Control Headers. In the modern web page, the content that hasn’t changed such as a company logo for a long of periods. It shouldn’t repeatedly download because it’s wasteful on the bandwidth.

For thoughtfully, just for your blog logo, it needs at least 3 seconds to fully load. So If the browser cache now activated correctly, it can ensure that logo image is stored on the user’s PC for about one month or a year and hereafter no longer be downloaded from the server or must be requested. To ensures that, your blog response less to the server but fast to the visitors, you need to control how the cache files store the data locally on the visitor’s computer.

As a matter of choice, it should even set the browser cache for normal HTML pages, so the blog page doesn’t need to be regularly requested from the server, but for the case, only once per hour.

Now, simply copy the code below to the .htaccess file located in the root directory of WordPress.

# Cache Headers
<ifmodule mod_headers.c>

# One month for image files
<filesmatch “\.(ico|flv|jpg|jpeg|png|gif|css|swf)$”>
Header set Cache-Control “max-age=2678400, public”
</filesmatch>

# A couple hours for Cache HTML files
<filesmatch “\.(html|htm)$”>
Header set Cache-Control “max-age=7200, private, must-revalidate”
</filesmatch>

# One day for Cache PDFs
<filesmatch “\.(pdf)$”>
Header set Cache-Control “max-age=86400, public”
</filesmatch>

# One month for Cache CSS & Javascripts
<filesMatch “.(css|js)$”>
Header set Cache-Control “max-age=2678400, private”
</filesmatch>
</ifmodule>

In the code, I set Image files for a month, CSS and JavaScript files for a month, PDFs for a day, and HTML files down for a couple hours in the browser cache.

In this theory, the user will see new items only after the cache-time. For reliably, I set the image files for a month instead of a year in the browser cache.

The last chapter in Part 3 of the series!

In Part 3 of the series, we will go one step further with many valuable WordPress plugins that activate the Beast Mode for more performance on your blog.

Don’t worry! It won’t complicated because this series will be aimed at newcomers and inexperienced novices specifically.

Don’t forget the last part! It’s the best of all parts! Thanks for coming! 😉