Your host sends an email saying the account has hit its CPU limit. Or the site slows to a crawl every afternoon, the dashboard fills with timeouts, or visitors see a 503 or a “Resource Limit Is Reached” page. The reflex is to buy a bigger plan, and sometimes that is the right call. More often it is an expensive way to postpone the real problem, because high CPU on WordPress is rarely about the size of your server. It is about how many requests reach PHP and how much work each one does.
That is the single most important idea in this guide. Every request that reaches PHP boots WordPress, loads every active plugin, runs database queries and builds a page or a response. That costs processor time. A request answered from a page cache, a CDN or a static file costs almost nothing. So every CPU problem on WordPress reduces to two questions: why are so many requests reaching PHP, and why is each one so expensive?
The answers fall into two families of fixes. The first family reduces the number of requests that reach PHP: page caching, edge caching, bot filtering, rate limiting, and blocking junk traffic before it ever touches WordPress. The second family reduces the cost of the requests that must reach PHP: trimming slow plugins and queries, taming the Heartbeat API and admin-ajax, moving scheduled jobs off page loads, adding an object cache, running a current PHP version with a sensible worker count, and moving heavy jobs such as image processing out of peak hours.
The mistake most people make is reaching for a fix from the wrong family. They install a caching plugin when the load is a brute-force attack on the login page that no page cache will ever answer. They delete plugins one by one when the real cause is a crawler walking thousands of filter URLs. They raise PHP memory limits, which has nothing to do with CPU. They pay for more cores, and the new cores fill up with exactly the same wasted work within a week.
This tutorial is a diagnostic route, in the order that wastes the least of your time. First you learn what the host’s CPU numbers actually mean and what a single WordPress request costs. Then you read the evidence: resource graphs, the process list and the access log. Next comes the decision that matters most, whether you have a traffic problem or a code problem. After that come the fixes in roughly the order of payoff: bot and login-attack control, page caching, Heartbeat and admin-ajax, a real system cron in place of wp-cron, a plugin and query audit, object caching and the database, PHP version, workers and heavy jobs, and finally the question of when to scale the plan.
A few ground rules before you start. WPresident has not benchmarked these changes for this post, so there are no performance numbers here; where a figure appears in an example, it is an illustration and not data. Commands assume a Linux server with shell access. If you are on shared hosting without SSH, most steps have an equivalent in your host’s dashboard, and the sections say what to look for. Take a backup before you change anything, make the change on a staging copy when you can, and change one thing at a time so you know which change worked. Vendor limits, plan features and dashboard layouts change, so treat any mention of them as something to verify on the vendor’s current documentation.
Key points
- CPU is spent when requests reach PHP, so you either reduce how many reach it or reduce what each one costs, and you must know which problem you have before you pick a fix.
- Read the evidence first: host graphs, the process list and the access log tell you whether the spike came from request volume, from slower code or from a schedule.
- Bots, crawlers and login attacks cost the same CPU as visitors but earn nothing, and they are best stopped at the edge or the web server before PHP starts.
- A page cache with a high hit rate is the largest lever, but it does nothing for logged-in users, carts, search, admin-ajax or login traffic.
- The Heartbeat API and wp-cron are fine in moderation and costly at scale; slow Heartbeat down and replace wp-cron with a real cron job that you verify.
- Audit plugins and queries by measuring, not guessing, and add a persistent object cache and a current PHP version only after the cheap fixes are done.
- Scale the plan last, and only after you can show that legitimate, well-cached traffic still saturates the current limits.
What high CPU really means, and how your host counts it
“High CPU” is several different problems wearing the same name, and your first job is to learn which one your host is reporting. Start with how the number is produced.
On a dedicated server or a VPS, CPU usage is the share of the machine’s total processing capacity that is busy, averaged over a short window. A four-core machine at 100 percent is using all four cores. On shared and managed hosting you are usually not looking at the whole machine. You are looking at your own account’s slice, enforced by the operating system. Many shared hosts use control groups or a tool such as CloudLinux LVE for this, but check what yours uses. The limit may be expressed as a percentage of one core, as CPU seconds per period, or as a cap on simultaneous processes or PHP workers. When you cross it, the host does not need to crash anything. It throttles your processes, and you see slow pages, 503 errors or a resource-limit page. Being throttled at your account’s limit is a different situation from the whole server being busy, so read your host’s documentation on how the limit is enforced and what it counts.
Load average is a separate number and is easy to misread. On Linux it counts processes that are running or ready to run, plus those waiting on uninterruptible disk input and output, averaged over one, five and fifteen minutes. A load of 4 on a four-core machine means roughly every core has work. A load of 12 on the same machine means there is a queue. Because disk waits count, a server with a slow disk, or one that is swapping memory to disk, can show high load with only moderate CPU use. This is why you read both numbers together.
Then there is the gap between CPU time and wall-clock time. A request that waits two seconds for a remote API, such as a license check, a social feed, a shipping rate lookup or a payment gateway, uses almost no CPU but occupies one PHP worker for two seconds. Enough of those and every worker is busy, new requests queue, and the site feels exactly like a CPU problem even though the processor is mostly idle. When pages are slow but CPU is low, think about workers, remote calls and database waits before you think about computation.
The shape of the graph matters as much as its height. A sustained plateau near the limit means steady demand exceeds capacity: too many uncached requests, or a heavy recurring job. A sharp spike that falls back within minutes points to an event, such as a crawler burst, a cache purge, a backup or a cron batch. A slow upward creep over weeks points to data growth: a bloated options table, a growing queue of scheduled actions, a log table nobody prunes.
The comparison below lists the metrics you will meet and what a high reading usually points to. Treat it as a list of suspects, not a verdict.
Reading the host metrics
| What it measures | What a high reading usually points to | |
|---|---|---|
| CPU percent | Busy share of processor capacity, or of your account allowance | Real computation: uncached PHP, heavy plugins, image jobs, compression |
| Load average | Processes running or queued, including those waiting on disk | More work than cores, or slow storage or swapping behind it |
| Busy PHP workers | How many PHP requests are in flight at once | Slow requests, hanging remote calls, or a burst with no cache |
| I/O wait | Time the CPU sits idle waiting for storage | Slow disk, memory swapping, or huge database scans |
| Memory and swap | RAM in use and pages pushed out to disk | Too many workers for the RAM, or a runaway long process |
| Requests per minute | Raw arrivals at the web server | A traffic event; divide CPU by this to see cost per request |
What a single WordPress request does to your processor
To understand why CPU rises, you need a picture of what one uncached request costs. When a visitor asks for a page that is not cached, the web server (nginx, Apache or LiteSpeed) hands the request to PHP, usually through PHP-FPM, which keeps a pool of worker processes. A worker picks it up, and WordPress starts from nothing, because PHP forgets everything between requests. It reads the configuration file, loads core, and then includes the main file of every active plugin plus the theme’s functions file. It fires the early hooks and reads the autoloaded rows of the options table in one query. It works out what the URL means, runs the main query for the page, then runs further queries for menus, widgets, related content and whatever else the template asks for. Finally it assembles the HTML and sends it.
Three consequences follow from this. First, the bootstrap cost is paid on every request, whatever the request is for. The REST API, admin-ajax.php, wp-cron.php, xmlrpc.php and wp-login.php all load WordPress before they do their small job. A tiny Ajax call that returns one value can cost nearly as much CPU as a full page view. Second, the cost scales with what plugins do on every request, not with how many plugins you have. Twenty quiet plugins can cost less than one that runs a complicated query in its init hook. Third, OPcache, which keeps compiled PHP in memory, removes the cost of parsing PHP files but not the cost of running them. It is essential, and it is not a substitute for page caching.
There is a fourth, less obvious consequence: 404 pages are expensive. If a request is for a file that does not exist, such as an old image, a path a vulnerability scanner invented or a mistyped URL, many server configurations pass it to WordPress. WordPress loads everything, finds nothing and renders your theme’s full 404 template. A bot that requests thousands of nonexistent URLs is therefore a stress test of your whole stack. A well-configured server answers a 404 for a missing static file directly, without PHP, and you should confirm that yours does.
Now contrast that with the cheap paths. A static file is served by the web server straight from disk, or by a CDN, with no PHP involved. A cached page is served from stored HTML. A request answered at an edge network never reaches your server at all. In each case the work is small and does not grow with the number of plugins you run.
A request, then, is cheap if it is answered before PHP starts, and expensive in proportion to what plugins, queries and templates add after the bootstrap. Your goal is to push as many requests as possible to the cheap side and trim the cost of those that must stay on the expensive side. The flow below follows one uncached request and notes where the CPU time goes at each step.
One uncached request, step by step
- Request arrivesThe web server looks for a static file or cached copy first; a miss goes to PHP.
- PHP worker startsOne worker handles one request at a time; if all are busy, the request queues.
- Core and plugins loadEvery active plugin and the theme functions file are included on every request.
- Options and setupAutoloaded options load in one query, which is slow when that data is large.
- Main and extra queriesThe page query, menus, widgets and plugin queries all hit the database.
- Template rendersTheme and builder code turns the data into HTML, sometimes with heavy logic.
- Response sentThe worker is freed; a cache could have stored this output for the next visitor.
Read the evidence first: graphs, the process list and the logs
Before you change anything, collect three kinds of evidence: what the host’s graphs say, what the server is doing right now, and what the access log says arrived. Twenty minutes here removes most of the guesswork that follows.
Start with the graphs. Your host’s dashboard or server panel will show CPU, memory, disk activity and, on some platforms, PHP worker or process counts over time. Note the exact window of the problem, and check which time zone the graph uses, because a mismatch with your server logs sends you looking at the wrong hour. Note also whether spikes line up with the clock. Spikes on the hour, or every night at the same minute, strongly suggest a scheduled job.
If you have shell access and the problem is live, look at the machine. The command uptime prints the load averages, nproc prints the number of cores, and top shows processes; press Shift+P inside it to sort by CPU. What you want to learn is which process is busy: PHP-FPM workers, the database server (mysqld or mariadbd), a backup or compression tool, or something you do not recognise. The user name beside a PHP-FPM process tells you which site on a multi-site server is responsible. If the database is the top consumer, the cause is queries, and PHP-side fixes will help less than you expect.
$ uptime
$ nproc
$ ps -eo user,pid,pcpu,etime,cmd --sort=-pcpu | head -15
$ wp db query "SHOW FULL PROCESSLIST;"
Then read the access log. Its location depends on your host and server software: nginx commonly writes under /var/log/nginx, Apache under /var/log/apache2 or /var/log/httpd, and panels often keep one log per site. The commands below assume the common combined log format. Narrow to the hour of the spike, then count who and what arrived: the first lists the busiest IP addresses, the second the most requested paths, the third the user agents, and the fourth counts requests per minute across the whole file.
$ grep "17/Nov/2026:09:" /var/log/nginx/access.log | cut -d ' ' -f1 | sort | uniq -c | sort -nr | head -20
$ grep "17/Nov/2026:09:" /var/log/nginx/access.log | cut -d ' ' -f7 | sort | uniq -c | sort -nr | head -20
$ grep "17/Nov/2026:09:" /var/log/nginx/access.log | cut -d '"' -f6 | sort | uniq -c | sort -nr | head -20
$ cut -d ' ' -f4 /var/log/nginx/access.log | cut -c2-18 | sort | uniq -c | sort -nr | head -10
The per-minute count is the quickest way to see when a burst began. If the site sits behind a CDN or proxy, the first field may be the proxy’s address rather than the visitor’s unless the server restores real client addresses, so check your host’s documentation.
Look for patterns rather than single lines: one address with a count far above the rest; paths such as wp-login.php, xmlrpc.php, admin-ajax.php, wp-cron.php or a search URL with a question mark; a user-agent string that is empty or claims to be a crawler; and a large share of 404 responses. Two further sources help. The PHP-FPM slow log, enabled with the request_slowlog_timeout and slowlog settings in the pool configuration, writes a stack trace for any request that exceeds the threshold, and the trace usually names the plugin file at fault. And the process list query above shows long-running database queries and how long each has been running.

Traffic problem or code problem: the triage that decides your fix
With the evidence in hand you can answer the question that decides everything else: is this a traffic problem or a code problem? The distinction sounds academic, and it is the most practical one in this guide, because the fixes barely overlap.
Use two numbers: requests per minute, and CPU per request, which you get by dividing CPU use by the request count for the same window. If requests rose and CPU rose with them, and the cost per request is roughly unchanged, you have a traffic problem: more demand against the same code. If requests stayed flat and CPU rose, the cost per request went up, and you have a code or data problem: something got slower.
Traffic problems split again by who is asking. Real visitors arriving in a burst after a newsletter, a social post or a press mention are good news with a bad side effect, and caching is the answer. Crawlers and scrapers produce the same load for no benefit, and filtering is the answer. A targeted flood to one expensive URL, such as the login page, the search page or an Ajax endpoint, is either abuse or a badly built feature, and rate limiting or fixing the endpoint is the answer.
Code and data problems usually have a trigger, so ask what changed. Did a plugin, theme or WordPress update land? Did you install something new? Did you import a few thousand products or posts, or switch on a feature such as related posts or live search? Did a remote service the site calls become slow? Did the database grow past the point where a query that used to be quick now scans a whole table? Your update log, your host’s event history and your backup timestamps are the quickest sources for answering these.
A third pattern is neither of those: it is the clock. Spikes at fixed intervals, such as every five minutes, on the hour or nightly, are scheduled work: wp-cron events, backups, security scans, search reindexing, mail queues or cache preloading. You find these by timing, not by traffic, and the cron section covers them in detail.
Finally, watch whose requests are expensive. Logged-in users and admin screens (editors, Heartbeat, dashboards, bulk actions) behave differently from anonymous visitors, because they bypass page caches. A handful of editors with several admin tabs open can outweigh thousands of cached visitors. If the busy requests are POSTs or sit under wp-admin, you are in that territory, and the Heartbeat section is your next stop. The decision below summarises where each answer sends you.
Traffic or code: where to go next
Bots, crawlers and login attacks
Automated traffic is the most common surprise in a CPU investigation, because it is invisible to analytics tools that run in the browser. Bots do not run JavaScript, so your analytics can show a quiet week while your server log shows a flood. Only the server-side log tells the truth.
It helps to sort automated traffic into kinds. Search engine crawlers are useful, mostly well behaved and verifiable: a genuine crawler’s address resolves back, through reverse DNS, to the search engine’s own domain, and the user-agent string alone proves nothing because anyone can forge it. Other crawlers, including SEO tools and AI data collectors, vary in quality. Reputable operators document their user-agent names and honour robots.txt, but check each operator’s documentation instead of assuming. Scrapers and vulnerability scanners ignore the rules and probe for known plugin paths, backup files and login pages. Credential-stuffing bots hammer wp-login.php and xmlrpc.php. Comment and form spammers send POST requests to comment and contact endpoints.
What makes bots expensive is the URLs they choose. Filter and sort parameters on a store, calendars that continue forever, internal search result pages and combinations of tags can expose a very large number of crawlable addresses. Every one is a cache miss, so every one costs a full PHP request.
Handle bots in layers, cheapest first. The polite layer is robots.txt: disallow internal search and parameter-driven URLs that have no search value. It only affects crawlers that choose to obey, and a Crawl-delay line is honoured by some crawlers and ignored by others. The reliable layer is enforcement before PHP. A CDN or firewall in front of the site can challenge or block known bad bots and apply per-address rate limits to expensive paths such as login and search. Cloudflare and other edge services offer these controls, though plan limits and feature names change, so verify what your plan includes. Blocking whole countries or networks is possible, but it can also block real customers, so use it narrowly and only with a business reason.
At the web server you can deny or rate limit paths you never use. If you do not use XML-RPC, block xmlrpc.php, after checking that no integration you rely on, such as a mobile app or a plugin connector, needs it. Brute-force attempts on wp-login.php cost the same CPU whether or not they succeed, so two-factor authentication protects the account but does nothing for the load. Those attempts need to be rate limited or banned before PHP, for example with fail2ban reading the access log, or with a rate limit in the web server or at the edge. Security plugins can limit login attempts too, but they run after PHP has booted, which makes them the last and costliest layer, not the first.
No rule survives untested. After adding a block, watch the log and confirm that your own admin sessions, uptime monitors, payment webhooks and search engine crawlers still get through.
Stop a bad request as early as it is cheap
Page caching: take PHP out of the path
Page caching is the largest CPU lever for most public WordPress sites, because it removes PHP and the database from the path entirely. Once a page’s HTML is stored, serving it is close to serving a static file. The metric to care about is the hit rate: the share of page requests answered from cache. After that, CPU scales with the number of misses, not with traffic.
Caches exist at several layers, and where yours lives matters. Edge caches, meaning a CDN with full-page caching, answer before traffic reaches your server. Server-level caches, such as an nginx FastCGI cache, LiteSpeed’s built-in cache or Varnish, answer from the web server without starting PHP. Plugin caches store HTML files and either let server rewrite rules deliver them directly or load a small PHP drop-in early to serve them; the second route is cheaper than a full request but not free. Check in your host’s dashboard which of these is already on before installing anything, because two page caches running together cause confusing results.
One point surprises many people: a CDN does not automatically cache your pages. Cloudflare’s default behaviour, for example, caches static files by extension and passes HTML through to your server, so a site behind Cloudflare can still send every page view to PHP. Caching HTML at the edge needs an explicit feature, such as Cloudflare’s Automatic Platform Optimization for WordPress, or a cache rule you write yourself. Check the plan requirements on the vendor’s page. You can confirm what is happening by requesting a page twice and reading the response headers in your browser’s network tab, or with curl -I. Most caches add a header that says hit or miss, though the names vary.
Then look at what bypasses the cache, because that is where the remaining CPU goes. Typical bypass rules cover logged-in users, anyone with items in a cart, checkout and account pages, POST requests, preview URLs and addresses with query strings. Marketing parameters appended to links can create a separate cache entry per URL unless the cache ignores them, and most good caches keep a list of ignored parameters, so verify yours. A WooCommerce-style store caches the catalogue but not the cart, checkout or account pages, which is why its CPU need grows with shoppers, not with browsers.
Two traps deserve a warning. The first is purging. A purge-everything on every post save or plugin update empties the cache while traffic continues, so every visitor triggers a regeneration at the same moment, a stampede. Prefer purging only the affected URLs and, where the cache supports it, serving the stale copy while a fresh one builds in the background. The second is preloading. Cache warmers crawl the site to fill the cache, which spikes CPU while they run, so limit their concurrency and run them off-peak.

Heartbeat and admin-ajax: the quiet CPU drain
Two WordPress features account for a surprising share of CPU on sites with several editors or chatty plugins: admin-ajax.php and the Heartbeat API. They are related, because Heartbeat sends its messages to admin-ajax.php.
The admin-ajax.php file is WordPress’s built-in endpoint for asynchronous requests. Themes and plugins use it for live search, cart updates, view counters, form submissions and many other front-end features, and the dashboard uses it constantly. Every call loads WordPress in full, and because these are usually POST requests, page caches do not answer them. A feature that fires an Ajax call on every page view quietly turns a cached site back into an uncached one. To find the culprit, count the calls in the access log, then open the Network tab in your browser’s developer tools on a public page: the request body shows an action parameter that names the feature. If a plugin calls admin-ajax on every page load for something that could be cached or done once, check its settings for a lighter mode, or look for an alternative.
$ grep -c "admin-ajax.php" /var/log/nginx/access.log
The Heartbeat API is a timer in the browser that sends a small request to the server at intervals. WordPress uses it for post locking (the notice that someone else is editing), for autosave, and for the login-expired warning, and plugins add their own data to it. Every open admin tab ticks. The pulse is roughly every 15 seconds on post editing screens and about every 60 seconds elsewhere, slowing when a tab is inactive; verify the timings for your WordPress version. Ten people with several tabs each can generate a steady stream of full WordPress loads while nobody is clicking anything.
The safest first move is to lengthen the interval, not to switch Heartbeat off. WordPress limits the value to between 15 and 120 seconds. Put this in a small must-use plugin or a child theme, not in a theme you will replace.
add_filter( 'heartbeat_settings', function ( $settings ) {
$settings['interval'] = 60;
return $settings;
} );
A blunter option is to stop the Heartbeat script loading on admin screens other than the post editor, which keeps locking and autosave where editors need them. Removing the script can also remove the login-expired prompt on those screens, so test with a real editor account.
add_action( 'admin_enqueue_scripts', function ( $hook ) {
if ( 'post.php' !== $hook && 'post-new.php' !== $hook ) {
wp_deregister_script( 'heartbeat' );
}
}, 1 );
Disabling Heartbeat everywhere is the most extreme setting and carries the real risk: without post locking, two editors can overwrite each other’s work without warning. Many optimisation plugins and some hosts offer Heartbeat controls on a settings page, which is easier than code. Use one mechanism, not two, and test afterwards by opening the same post in two browsers.
How hard to restrict Heartbeat
How to read this: each row is one option, and its dot shows where it sits between Fewest side effects and Most side effects. Placement is an editorial judgement, not a measurement.
- 1Leave the defaultsNo side effects, highest request volume.
- 2Raise the interval to 60 secondsSlower autosave and lock updates.
- 3Stop Heartbeat outside the editorCheck the login-expired prompt.
- 4Disable it everywhereRisk of overwritten edits.
Replace wp-cron with a real cron job, carefully
WordPress has no true scheduler. WP-Cron is a pseudo-cron: scheduled events are stored in the database, and on page loads WordPress checks whether any are due and, if so, fires a background request to wp-cron.php to run them. That design has two CPU consequences. On a busy site, every uncached page load performs the due-check, and bursts of due events can start overlapping runs. On a quiet site the opposite happens: nothing runs until someone visits, so jobs are late. In both cases the work executes inside web requests under web limits, and a long job such as an import, a backup, a batch of queued emails or a store’s queued actions can hold a worker and a core for minutes.
The fix is to stop triggering cron from visits and run it from the server’s own clock. It takes two steps, and you must do both. If you disable WP-Cron without scheduling a replacement, all scheduled work stops: scheduled posts miss their time, update checks and backups stall, and store emails and subscription renewals queue up unseen.
Step one is a constant in wp-config.php, placed above the line that tells you to stop editing.
define( 'DISABLE_WP_CRON', true );
Step two is a system cron entry that runs the due events with WP-CLI. Add it with crontab -e as the user that owns the site files, not as root. Cron has a minimal path, so use the full path to wp (the command which wp shows it) and your own site directory. The flock command skips a run if the previous one is still going, which prevents overlap.
*/5 * * * * flock -n /tmp/wp-cron-example.lock /usr/local/bin/wp --path=/var/www/example.com cron event run --due-now
Every five minutes is a common starting point; a store with time-sensitive queues may want every minute. Verify the result before you walk away: wp cron event list shows each event with its next run time, and those times should keep advancing after cron has run. Check that a scheduled post publishes on time. On Multisite, run the command for each site, using the url option with the address of each site in the network. Many managed hosts already disable WP-Cron and run it for you, and many panels have a cron screen, so check before duplicating work.
One subtlety: the constant only stops WordPress from spawning cron on page loads. A direct request to wp-cron.php still runs it, so a bot hitting that file can still trigger work. You can block public access to the file once your system cron uses WP-CLI, not an HTTP request.
Finally, use the event list to find heavy hitters: an event scheduled every minute, the same hook registered dozens of times, or a recurrence that matches your spike times all point to a plugin worth examining.
$ wp cron event list --fields=hook,next_run_relative,recurrenceWP-Cron versus a system cron job
| Built-in WP-Cron | Real system cron | |
|---|---|---|
| Trigger | A visitor loads a page | The server clock |
| Timing | Late on quiet sites, bunched on busy ones | Predictable, as scheduled |
| Where jobs run | Inside a web request, under web limits | A command-line process, outside the web worker pool |
| Overlap | A lock helps, but long jobs can still stack | You control it, for example with a lock |
| If misconfigured | Jobs run late | Nothing runs at all, so verify |
Audit plugins, themes and queries by measuring
When the evidence says the cost per request went up, the cause is code or data, and guessing is how people lose a weekend. Measure instead, on a staging copy where you can, because deactivating plugins on a live site has side effects.
The best first tool is Query Monitor, a free plugin that shows, for each page load, the database queries grouped by the plugin, theme or core component that ran them, plus duplicate queries, slow queries, HTTP calls to remote services and hook timings. Look for three things: a component whose queries dominate the total time, the same query repeated many times, and remote HTTP calls made during a page load, which tie up a worker while the code waits. With WP-CLI you can also install the profile command package, which breaks a request into stages and hooks and shows how long each took.
$ wp package install wp-cli/profile-command
$ wp profile stage
$ wp plugin list --status=active
Without tools, use bisection. Deactivate half the active plugins on staging, measure, and narrow down. Measure something stable, such as the server response time of one uncached URL, and repeat it a few times, because a single sample is noise.
It helps to know the usual suspects by category, not by brand. They include plugins that run heavy queries to show related posts, popular posts or statistics on every request, security and backup plugins that scan or compress files, broken-link checkers, live search, social feed and review widgets, page builders with heavy dynamic templates, and anything that writes to the database on every page view, such as hit counters. Plugins that call a remote service during a page load, for license checks or feeds, belong on the list too, because a slow remote API holds a worker. Your options are to change the setting, schedule the job off-peak, cache its output, swap it for a lighter alternative, or remove it. Inactive plugins are not loaded and cost no CPU, but delete the ones you do not need anyway to reduce your attack surface.
For your own queries, WP_Query accepts arguments that skip work you do not need. Avoid fetching everything with a posts_per_page of -1, and skip the pagination count and the meta and term caches only when the loop does not use them.
$query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 10,
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
) );Object caching, the options table and the database
Page caches help anonymous visitors. Logged-in users, carts, search and wp-admin bypass them, and for those requests a persistent object cache is the next lever. WordPress has an internal object cache, but by default it lives only for the length of one request. A persistent object cache, usually Redis or Memcached, keeps the results of repeated lookups, such as options, terms and post objects, in memory between requests so they are not fetched from the database again. It needs a drop-in file named object-cache.php in the wp-content folder, normally installed by a plugin, plus server-side support: Redis or Memcached running and the matching PHP extension. Many hosts offer this as a switch, so verify what yours provides.
Expect the biggest effect on dynamic requests: admin screens, WooCommerce, membership sites and uncached pages. Expect little on a fully page-cached brochure site, because those requests never reach PHP. Operating it well means giving each site its own key prefix or database on a shared Redis server, sizing the memory with an eviction policy suited to caching, remembering that a full flush makes the next requests slow while it refills, and confirming the site still works if the cache is down. If you use the Redis Object Cache plugin, it adds WP-CLI commands for checking the connection.
$ wp redis status
$ wp transient delete --expired
With a persistent object cache, transients move out of the options table, which removes a source of database churn. Without one, expired transients pile up there, and the second command above clears them.
Now the database itself. Autoloaded options are read on every request, so a large pile of autoloaded data, often left behind by removed plugins, slows every page. This query lists the largest entries. Adjust the table prefix if yours is not wp_. Older WordPress versions mark autoloaded rows with yes, newer ones use several values, and the list below covers both.
SELECT option_name, LENGTH(option_value) AS size_bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto', 'auto-on')
ORDER BY size_bytes DESC
LIMIT 20;
Do not delete rows you do not recognise. Identify the owner first and remove the data through that plugin where possible. Turn on the slow query log to see which queries run long, then ask the database to explain them: a query that scans a whole table, typically a meta query on the postmeta table or a LIKE search, needs a different approach or an index. Built-in WordPress search is a LIKE scan, which gets slow on large sites, and a dedicated search service is the usual escalation. Recent WooCommerce versions also support high-performance order storage, which keeps orders out of the posts tables; verify the status in your store settings and test on staging before changing it.

PHP version, workers and heavy background jobs
Three server-side areas change how much CPU the same code burns. The first is the PHP version. Newer supported PHP versions have generally run WordPress faster than older ones, and old versions stop receiving security fixes. Check the version in Site Health, under its Info tab, and in your host’s dashboard. Check each plugin’s and theme’s stated compatibility, test on staging, and move up one supported step at a time. Make sure OPcache is enabled with enough memory for your code, because when its memory fills PHP recompiles files again and again.
The second is PHP-FPM workers. The pm.max_children setting caps how many requests run at once. Set it too low and requests queue, so visitors see slow pages or 502 and 504 errors while the CPU sits idle. Set it too high and workers fight for cores and memory, and on a small server a flood can push memory into swap and make everything worse. A common method is to divide the RAM you can spare for PHP by the typical memory one worker uses, measured from the process list. Do not treat a bigger number as a cure: the cap is also a protection. Use the slow log to see what occupies workers. On managed hosts the worker count is part of the plan, so verify how many yours includes.
The third is heavy background work, and image processing leads the list. When you upload an image, WordPress creates every registered size using GD or Imagick, and themes and plugins register many sizes. A bulk import, a thumbnail regeneration or an optimisation plugin recompressing the whole library can saturate the CPU for hours. Run such jobs off-peak and in small batches, and limit the registered sizes and the upload dimensions at the source. Compression and format conversion done by an external service or CDN moves that cost off your server. The same logic applies to backups and malware scans: zip compression and file scanning are CPU-heavy, so schedule them overnight and stagger them so they do not overlap with each other or with cron events.
A last caution on background queues. Plugins that process mail, imports or store tasks in the background often rely on WP-Cron or on Action Scheduler, which WooCommerce bundles. A large backlog can keep the CPU busy for a long time after the original cause has gone.
When to scale the plan, and how to prove a fix worked
Scale last. If legitimate, well-cached traffic still saturates the plan after bots are filtered, the cache hit rate is high, cron runs on a real clock, admin load is tamed and plugins are audited, you have a genuine capacity problem and more resources are the right answer. If you scale first, you pay for the waste, and a bot flood or a runaway query will consume whatever you give it.
Read plan limits in terms of the metrics from the first section: cores or CPU allowance, PHP workers, memory, process limits and disk activity, not the marketing name of the tier. A simple illustration, not data: if an uncached page costs about half a second of CPU on one core, that core can build roughly two such pages a second, so uncached traffic such as checkouts sets your capacity, not your raw page views. Stores and membership sites need headroom for logged-in concurrency, while brochure sites mostly need a good cache. Your options include more cores and workers on the same platform, a move from shared hosting to a VPS or managed plan, separating the database or Redis onto their own resources, and a CDN for static files. When you compare hosts, ask how CPU is limited and what happens at the limit: throttling, queueing or errors.
Prove each fix with the same instruments you used to find the problem. Record a baseline first: the CPU graph, load, requests per minute, the cache hit ratio and the response time of a few uncached URLs. Change one thing, then compare the same hour on a comparable day, and keep a short change log so you can reverse a step. Do not load-test a production site or a host without permission, since many hosts forbid it. Watch for regressions that CPU graphs hide: a cache serving stale content, a block catching a legitimate bot, or a cron job that quietly stopped running.
A sensible order of operations
Checklist
- Write down the exact time window of the spike and the time zone your graphs and logs use.
- Compare requests per minute with CPU for that window to decide between a traffic problem and a code problem.
- Count the top addresses, paths and user agents in the access log for the spike hour.
- Verify claimed search engine crawlers by reverse DNS, not by user-agent string.
- Rate limit or block login, XML-RPC, search and filter URLs before PHP, then test that real traffic still passes.
- Confirm one page cache is active and that response headers show a hit on the second request.
- Count admin-ajax.php calls and identify the action behind the biggest source.
- Lengthen the Heartbeat interval and test post locking in two browsers.
- Schedule a real cron job with a lock before disabling WP-Cron, then verify with the event list.
- Profile slow requests with Query Monitor or WP-CLI on staging before removing any plugin.
- Check the autoloaded options size and review the slow query log.
- Add a persistent object cache only after the cheaper fixes, with a per-site key prefix and a tested failure mode.
- Move to a current supported PHP version on staging first, and confirm OPcache is enabled.
- Schedule backups, scans and image jobs off-peak and stagger them.
- Re-measure against your baseline after each change and keep a change log.
Read this next
About this guide. This is general guidance written by WPresident Editorial from documentation and widely used practice. WPresident has not benchmarked the products or methods described. Interfaces and plan limits change, so check the vendor’s current documentation before you act. Not legal, tax or financial advice. See our editorial policy.
Frequently asked questions
Why is my CPU high when my traffic is low?
CPU follows uncached requests and background work, not visitor counts. Bots do not appear in browser-based analytics, scheduled jobs such as backups and scans run without visitors, and editors in wp-admin bypass page caches. Read the server access log for non-human traffic and the cron event list for recurring jobs before assuming the code is at fault.
Will installing a caching plugin fix high CPU?
It will if the load is anonymous page views that can be cached, and it will not if the load is logins, search, admin-ajax, logged-in users, carts or cron. Confirm with response headers that pages are served from cache and check what bypasses it. Running two page caches together causes confusing results, not extra speed.
Is it safe to disable the Heartbeat API?
Disabling it everywhere removes post locking, so two editors can overwrite each other, and it changes autosave and the login-expired prompt. Lengthening the interval, or stopping Heartbeat on screens other than the post editor, gets most of the saving with fewer side effects. Test with real editor accounts before relying on it.
Is it safe to disable wp-cron?
Only if you replace it. The constant stops WordPress triggering cron on page loads, but nothing then runs scheduled posts, updates, backups or store jobs unless a real cron job calls WP-CLI. Create the job first, run it as the site user, use a lock against overlap, and check that next-run times advance. Many managed hosts already handle this.
How do I find which plugin is using the CPU?
Measure it. Query Monitor shows queries, remote calls and hook timings by component, the PHP-FPM slow log names the files behind slow requests, and WP-CLI profiling splits a request into stages. Otherwise bisect on a staging copy by deactivating half the plugins and timing one uncached URL. Avoid random deactivation on a live site.
Does Redis lower CPU usage?
It lowers the database work of requests that reach PHP, so it helps logged-in users, stores, membership sites and admin screens most. It does little where page caching already answers nearly every request. It also adds a service to run, so give each site a key prefix, test what happens if Redis is unavailable, and verify that your host supports it.
Can bots really cause high CPU?
Yes, and they are among the most common causes. Each uncached request from a bot costs the same PHP time as a visitor, and bots favour URLs that caches cannot hold: search, filters, login, xmlrpc.php and nonexistent paths that return 404. They are invisible in analytics, so read the access log and stop them at the edge or the web server.
Will upgrading PHP reduce CPU usage?
Often a little, and sometimes noticeably, since newer supported PHP versions have generally been faster for WordPress and are the only ones that get security fixes. It will not fix a runaway plugin, a bot flood or a slow query. Test on staging, check plugin and theme compatibility, and move up one supported version at a time.
Why does CPU spike right after I clear the cache?
An emptied cache means every request is a miss until pages are rebuilt, so traffic that was nearly free suddenly costs full PHP time, all at once. Purge only the URLs that changed, avoid purge-everything on routine saves, serve stale copies while rebuilding if your cache supports it, and run any preload with low concurrency.
When should I upgrade my hosting plan instead?
After the cheaper fixes: bots filtered, page cache hitting, cron moved, admin load limited and plugins audited. If legitimate traffic still reaches your CPU, worker or memory limits at peak, scale up. Scaling first mostly pays for waste. Also consider it when the cap is something you cannot tune, such as a per-account process limit on shared hosting.



