admin-ajax.php high CPU in WordPress: how to find the cause and fix it
TL;DR: admin-ajax.php is WordPress's built-in endpoint for background requests. Many things call it, including the Heartbeat API, which pings the server every 15 to 60 seconds while someone has the dashboard or the post editor open. These are POST requests, so page caching cannot serve them, and each one loads WordPress, your theme and your plugins. A few open dashboard tabs, or a plugin that calls admin-ajax.php on every page view, can use a lot of CPU on shared hosting and trigger resource-limit warnings. To fix it, find out what is calling the endpoint using your access logs and your browser's network tab, slow Heartbeat down or switch it off outside the editor, close idle dashboard tabs, replace plugins that abuse AJAX and cache or limit what you can.
What admin-ajax.php is
/wp-admin/admin-ajax.php is a single file that handles background (AJAX) requests from both the admin area and the front end. Each request names an "action", and WordPress runs the code registered for that action. Core WordPress, themes and plugins all use it for things like:
- autosaving posts,
- live search and filters,
- loading more posts,
- submitting some forms,
- sending data to and from page builders and widgets.
Because everything shares one endpoint, a single log line like POST /wp-admin/admin-ajax.php does not tell you who is calling it. You have to look at the action.
What the Heartbeat API does
The Heartbeat API is a core feature that sends a regular "pulse" from your browser to the server while you are logged in. It powers:
- Autosave while writing a post.
- Post locking, which warns you when someone else is editing the same post.
- Login session checks, which tell you when your session expires.
- Plugin data, since some plugins use Heartbeat for live notifications or dashboard widgets.
According to one developer guide, the pulse runs about every 15 seconds in the post editor and typically every 15 to 60 seconds elsewhere. Each pulse is a POST request to admin-ajax.php with the action heartbeat.
Why it can use so much CPU
- Each request boots all of WordPress. WordPress loads core, your active plugins and your theme before it runs the handler, so even a tiny pulse has a fixed cost.
- POST requests are not cached. Page caching and CDN caching apply to GET requests for pages, so these always reach PHP.
- Many tabs multiply it. Ten forgotten dashboard tabs on ten computers mean ten steady streams of requests.
- Your PHP slots are limited. On shared hosting, each pulse uses one of your limited simultaneous process slots, leaving fewer for real visitors. See hosting resource limits explained.
- Plugins make it worse. A plugin that fetches live data on every page view for every visitor can generate far more
admin-ajax.phpcalls than Heartbeat ever does.
One estimate in a developer guide suggests that 50 users with dashboards open can generate hundreds of requests a minute. Treat that as an order-of-magnitude illustration, since the real figure depends on your setup.
Step 1: confirm it is the problem
Look for these signs:
- Your host reports high CPU, I/O or entry-process usage. See the resource limit guide.
- Your site slows down in the admin area but less so for visitors.
- You see 508 or 503 errors when several people are working in the dashboard.
- Your access log shows frequent
POST /wp-admin/admin-ajax.phplines.
In cPanel, the Raw Access section lets you download your access logs. On a VPS, they are usually in /var/log/nginx/ or /var/log/apache2/. Count the requests:
grep "admin-ajax.php" access.log | wc -l
To see which IPs generate the most:
grep "admin-ajax.php" access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head
A small number of IPs with a high count usually means a few logged-in users or a misbehaving client. Many different IPs suggests visitors triggering AJAX on page views.
Step 2: find what is calling it
Logs show the request, but not the action, because the action is in the POST body. Use these methods to find it.
Your browser's developer tools.
- Open the page in Chrome or Firefox and press F12.
- Go to the Network tab and filter by "admin-ajax".
- Reload the page, or leave the dashboard open for a minute.
- Click a request and open the Payload (or Request) tab. Look for
action=.
If you see action=heartbeat, it is Heartbeat. If you see something else, such as action=get_live_data, the name often points to the plugin or theme that registered it.
Query Monitor plugin. On a staging site, Query Monitor shows slow queries and hooks for each request, including AJAX calls.
Deactivate and test. On staging, disable plugins one at a time and watch whether the requests stop.
Check the front end. Open a normal page as a logged-out visitor and watch the network tab. Any admin-ajax.php calls here come from the theme or plugins, not Heartbeat, which runs only for logged-in users in most setups.
Step 3: throttle or limit Heartbeat
If the action is heartbeat, you have three options. Use a small code snippet in a core functionality plugin or your child theme's functions.php. See child themes explained.
Option 1: slow it down. This keeps all features but sends fewer pulses:
add_filter( 'heartbeat_settings', function ( $settings ) {
$settings['interval'] = 60; // seconds
return $settings;
} );
Option 2: turn it off on the front end. This removes Heartbeat from public pages, where logged-in users do not need it:
add_action( 'init', function () {
if ( ! is_admin() ) {
wp_deregister_script( 'heartbeat' );
}
} );
Option 3: limit it in the dashboard, except in the editor. Some performance plugins include a Heartbeat control that lets you choose different behaviour for the dashboard, the post editor and the front end. Pick the setting that slows or stops the dashboard pulses but leaves the editor alone.
Do not fully disable Heartbeat in the post editor. You would lose autosave and post locking. A longer interval is safer.
Always test after a change. Open the editor, write some text, wait for autosave and check the post is saved.
Step 4: deal with plugin and theme calls
If the heavy actions come from a plugin or theme:
- Identify it from the action name and by deactivating on staging.
- Update it. Newer versions often fix inefficient AJAX use.
- Check its settings. Many plugins let you reduce refresh frequency or turn off live features.
- Cache what you can. If a plugin loads the same data for every visitor, a version that caches the result, or a server-side cache for that data, cuts the load.
- Replace it. If a plugin polls the server constantly for little benefit, find a lighter alternative. Live visitor counters, real-time notification widgets and some popular-posts tools are common offenders.
- Ask the developer. Send the action name and your log evidence to the plugin's support forum.
- Use a dedicated endpoint. For custom code, WordPress's REST API or a lightweight mu-plugin handler can load less than the full
admin-ajax.phpstack. This is a developer task.
Step 5: reduce the rest of the load
Fixing admin-ajax.php is one part of keeping CPU in check.
- Use page caching so anonymous visitors do not run PHP. See our guide on shared hosting capacity.
- Use an object cache such as Redis if your host supports it, to cut database work.
- Keep PHP up to date. Newer versions are faster. See the PHP 8.2 end-of-life guide.
- Limit bots. Block abusive crawlers and login attempts. See securing the WordPress admin.
- Review scheduled tasks. See WordPress cron jobs and scheduled posts.
- Close idle dashboard tabs, especially on shared computers.
- Upgrade your plan when the site has simply outgrown it. See cloud hosting versus VPS.
What not to do
- Do not block
admin-ajax.phpin.htaccessor the firewall. Many front-end features depend on it, and you would break your site. - Do not disable Heartbeat everywhere without checking the editor still autosaves.
- Do not assume all load is Heartbeat. Measure first.
- Do not edit core files. Updates will overwrite your change.
- Do not set an extremely long interval and forget about it. Session warnings and post locking may stop working as expected.
When it is not the real problem
Sometimes admin-ajax.php is just the visible symptom.
- Bots hitting it directly. A flood of POSTs from unfamiliar IPs may be an attack or a scraper. Rate-limit or block them at the firewall or CDN, using rules for abusive behaviour rather than for the file itself.
- Slow database. If every AJAX action runs slow queries, fix those. Query Monitor will show them.
- Underpowered hosting. If your site is healthy but the plan is small, the right fix is more resources.
- A single bad plugin. One plugin with an infinite polling loop can drown everything else.
FAQs
What is admin-ajax.php?
A WordPress file that handles background requests from the admin area, themes and plugins.
Is it safe to disable the Heartbeat API?
You can safely slow it down. Disabling it in the editor removes autosave and post locking, so most people only disable it on the front end and in the dashboard.
Why is admin-ajax.php using so much CPU?
Each request loads WordPress with all plugins and cannot be page cached. Many open dashboard tabs or plugins that call it on every page view multiply the load.
How do I see which action is being called?
Open your browser's Network tab, filter by admin-ajax and read the action field in the request payload.
Should I block admin-ajax.php?
No. Blocking it breaks features that rely on it. Throttle or fix the cause instead.
Does Heartbeat run for visitors?
In most setups, Heartbeat runs for logged-in users, in the dashboard, the editor and sometimes the front end. Visitors who are not logged in usually trigger other AJAX calls from plugins and themes, not Heartbeat.
Can a plugin slow Heartbeat down for me?
Many performance plugins include a Heartbeat control setting. Check the plugin you already use before adding another.
Will fixing this stop my host's warnings?
It may, if Heartbeat or a plugin was the main source of load. Combine it with caching and monitor your resource graphs to confirm.
Conclusion
High CPU from admin-ajax.php usually means the Heartbeat API or a plugin is sending uncacheable requests too often. Confirm it in your logs, identify the action in your browser's network tab, slow Heartbeat down, remove it from the front end, fix or replace noisy plugins and add caching. Do not block the file, and do not disable autosave.
HostCloud's hosting plans show you CPU and process usage so you can spot problems like this early. See the options at https://hostcloud.in.
Sources: