All blogs

Slow WordPress admin and high TTFB: where to look first

A slow dashboard and a slow first byte usually share a cause. A short order of checks: PHP and OPcache, object cache, autoloaded options, cron and slow queries.

A slow admin and a high time to first byte both come from slow PHP and database work, not from images or CSS. Check the PHP version and OPcache, add an object cache, trim autoloaded options, move WP-Cron to a system cron, and look at slow queries.

A slow dashboard and a slow first byte almost always share a cause: PHP and database work, not images or CSS. That is good news, because it narrows the search. Work through these in order, and measure after each change.

Measure before you change anything

Time to first byte (TTFB) is how long the server takes to start answering. Test a page that is served from cache and one that is not. If both are slow, the server is the problem. If only the uncached page is slow, WordPress is doing too much work per request. Query Monitor, a free plugin, shows which queries, hooks and plugins take the time on a single page load.

PHP version and OPcache

Run a supported PHP version, and make sure OPcache is on. Without it, PHP recompiles every file on every request. On older PHP versions this alone can be the largest single gain. Check the status page of your host or run php -i | grep opcache.

Add a persistent object cache

WordPress asks the database the same questions many times. A persistent object cache, such as Redis or Memcached with a matching plugin, keeps the answers in memory between requests. The admin benefits most, because it is never page cached.

Look at autoloaded options

Rows in wp_options marked autoload = 'yes' are loaded on every request. Old plugins often leave large ones behind. This query shows the total size:

SELECT SUM(LENGTH(option_value)) AS bytes
FROM wp_options WHERE autoload = 'yes';

A few hundred kilobytes is normal. Several megabytes is a problem. List the largest rows, then find which plugin owns them before you delete anything.

Move WP-Cron to a real cron job

By default WP-Cron runs when someone loads a page, which can add delay to unlucky visitors. Turn it off in wp-config.php and trigger it on a schedule:

define( 'DISABLE_WP_CRON', true );
*/5 * * * * wp cron event run --due-now --path=/var/www/site

Check the slow query log

If one query runs on every request and takes a long time, it will show up in MySQL's slow query log or in Query Monitor. Fixing it usually means removing or replacing the plugin that issues it, or adding an index.

When it is the hosting

If all of this is clean and TTFB is still high, the server itself may be overloaded, or PHP-FPM may not have enough workers. At that point more tuning in WordPress will not help, and the answer is a larger plan or a better host.

Frequently asked questions

What is a good TTFB for WordPress?

Under about 600 milliseconds for an uncached page is a reasonable target. Cached pages should be much faster.

Why is only wp-admin slow?

The dashboard is never page cached, so it shows the real cost of PHP, the database and plugins on every load.

Will a caching plugin fix a slow admin?

Page caching does not help the admin. An object cache, OPcache and fewer heavy plugins do.

What are autoloaded options?

Rows in wp_options that WordPress loads on every request. If they total several megabytes, every page pays for it.