We developed the perfmatters plugin to speed up your WordPress sites!

Diagnose admin-ajax.php Causing Slow Load Times in WordPress

If you have stumbled across this post then you are probably trying to diagnose what is causing your slow load times. And you have probably already narrowed it down to your admin-ajax.php file as the culprit. But why exactly is the admin-ajax.php file causing these heavy load times? Well, read my two suggestions below to try and diagnose the root cause of the problem on your WordPress site. Anyone that knows me or reads my blog knows that I am a little OCD when it comes to speed. I wrote this post for a friend, he knows who he is 🙂

There are two big problems with admin-ajax.php. 1st is WordPress Core and 2nd is Developer’s Plugins

What is the admin-ajax.php file?

Basically in WordPress 3.6 the WordPress Heartbeat API was introduced, which allows WordPress to communicate between the web-browser and the server. This improved upon session management, revision tracking, and auto saving.

WordPress Core using admin-ajax.php

The WordPress Heartbeat API uses /wp-admin/admin-ajax.php to run AJAX calls from the web-browser. While this is great and all it can also cause high CPU usage and crazy amounts of PHP calls. For example if you leave your dashboard open it will keep sending POST requests to this file on a regular interval.

To read more about this issue, I suggest reading this article on WordPress Heartbeat and heavy admin-ajax.php usage.

There is a great free plugin now in the WordPress repository called heartbeat control which can help you fix this problem. Follow the steps below to configure.

Step 1

Install Heartbeat control.

Step 2

Go to Settings and click into “Heartbeat Control.”

settings heartbeat control

Step 3

Under “Control heartbeat locations” you have a couple options:

  • Use default
  • Disable everywhere
  • Disable on dashboard page
  • Allow only on post edit pages (I use the “Allow only on post edit pages” myself)

heartbeat control configuration

You can disable it altogether but remember this controls auto-saving and if you are working on a multi-author blog with multiple sessions this is something to take into consideration. Also the heartbeat API is used by a variety of plugins and disabling it could cause them to stop functioning.

Step 4

Then you can setting the heartbeat polling frequency. I set mine to 60 seconds.

heartbeat frequency

That should hopefully take care of some of your problems. If you are still experiencing delays than I would take a look at the next issue below.

Developer’s Plugins using admin-ajax.php

This is problem I keep running into recently. It seems that a lot of 3rd party developers are now somehow using admin-ajax.php and requests are getting sent for queries within certain plugins. The other day I narrowed down some speed issues on my site and more than a 1 second delay (about 60% of my site’s delay) was being caused entirely by a 3rd party plugin polling admin-ajax.php. Follow the steps below on how you can try and track down which plugin might be causing this. There might be a more efficient way to find this, but so far I have always been able to narrow it down quickly this way without access to the server or installing anything.

Step 1

First go over to GTmetrix and run a free test of your website.

Step 2

Then click into the “Timeline” tab and scroll down. You will most likely have POSTs to admin-ajax.php. In my example below you can see I have 5 POSTS to admin-ajax.php and they are adding up to significant delays.

admin-ajax delays

Step 3

Now expand one of the POST requests and click into the “Post” tab to see additional details. What you care about is the “action” name. From this action name you can usually determine right away what plugin is causing the problem, as the action is usually named something similar to what the plugin is doing or is called. From my example I see it is the “get_shares_count” action. Oh and under “share_count_array” I see it mentions “buffer.” Well there is only one plugin on my site sends requests for share counts from buffer and that is my social media sharing plugin (monarch). So immediately I know what it is. You can then disable your plugin, clear your cache, re-run your test to confirm it. Most likely those admin-ajax.php requests will be gone. For me the fix turned out to be that I needed to enable “caching” on my social sharing plugin in the options.

post details gtmetrix

I have used this method above many times on different sites to quicly narrow down the plugin causing heavy load issues with admin-ajax.php.  You might have to reach out to the developer of your plugin to get a fix.

Additional Ways to Speed up WordPress

If you are looking for additional ways to speed up your WordPress site then I highly recommend you read a couple of my other posts:

The P3 Profiler plugin can also be very useful in determining what plugin might be causing a delay.

As always feel free to leave your comments below!


Marketing, WordPress, Blogging Tips, SEO and Reviews, once a week.

Thank you for subscribing.

Something went wrong.