Languages: English • 日本語 (Add your language)
This article is part of a series on WordPress Optimization.
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.
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.
Because WordPress is PHP-based, it contains a large amount of code that must be "parsed" by PHP on every single page load; if you are using a heavy theme or plugin, or a large number of plugins, the amount of PHP code grows exponentially.
In many server environments (especially shared hosting), this "parse" time can greatly affect performance, adding several seconds to the total time it takes to finish loading a page. This is where OPcode caching can help, sometimes drastically, as it avoids the need to (re)parse PHP code too often, by way of "caching" the PHP content in a temporary cache.
Throughout its lifetime, PHP has supported various OPcode caching extensions. For many years, the most popular one was called Zend, which was a proprietary third party script, followed by APC, which was also maintained by a third party. However, upon the release of PHP 5.5, Zend decided to open-source their code and contribute it entirely to the PHP project, at which point it was included (and enabled by default) as part of PHP installations.
OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. -- PHP.net
This is one of the reasons why it is so important to upgrade your PHP version. Many web hosts allow you to upgrade by request, while others do it automatically. And while OPcache is supported by PHP 5.5+ it has several more options available in PHP 7+ (along with generally faster PHP performance), so it's a good idea to stay as updated as possible.
Further Reading: