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. The first is WordPress Core and the second 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 at 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
Heartbeat Control

Step 3

Under “Control heartbeat locations” you have a couple of 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
Allow only on post edit pages

You can disable it all together 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
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.

You can also control heartbeat in our Perfmatter’s optimization plugin.

Developer’s Plugins using admin-ajax.php

This is a 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
GTMetrix speed test

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
Post action

I have used this method above many times on different sites to quickly 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 Query Monitor plugin can also be very useful in determining what plugin might be causing a delay.

As always feel free to leave your comments below!

author bio
Brian Jackson

I craft actionable content and develop performance-driven WordPress plugins. Connect on X, subscribe to my newsletter (once a month), or buy me coffee.

53 thoughts on “Diagnose admin-ajax.php causing slow load times in WordPress”

  1. The abuse of admin-ajax.php can bring down servers… I understand it’s needed on some pages (for carts and other crucial functionality) but I’m seeing a worsening trend of overusing it and making really hard to cache WordPress properly.
    Thanks for this post, I’m sure it will help a lot of people! :)

    Reply
  2. This article may be exactly what I’m looking for, Brian. My site’s front end is fine, but the admin section is painfully slow recently. Fingers crossed that I can sort it all out…

    Reply
      • Thanks for responding Terence… I somehow missed your comment Heather. But Terence is correct in the fact that the article above probably won’t fix your backend speed. If your backend is slow it could be a number of issues. Slow host, too many pages (WP recommends under 100, you can have as many posts as you want), etc…

        Reply
  3. I am facing a problem with my wordpress ecommerce site. When someone try to visit my site it’s blocked by avast. And it’s showing the malicious problem is admin-ajax.php file. I am not able to recognize which code need to remove. Can you please help me? I have tried so many blog but not found exact solution. I want my site will work with avast antivirus without any block.

    Thanks for your time

    Reply
  4. Great article. I used that plugin for heartbeat and it stopped a number of plugins from working, so as you say, only limit it to time only.

    Reply
    • Thanks Adam! Ya a lot of plugins now rely on admin-ajax.php so only limiting it should prevent any issues from arising with plugins. It’s a great little plugin.

      Reply
  5. I recently installed W3 Total Cache to speed up my website and it looked like everything was working. Today when I did a new speed test I noticed that three instances of admin-ajax.php took 1 second to load. Looked at the source code and noticed that calls from Bloom, Monarch and G7 are loaded every reload. Did you find a solution?

    Reply
    • Make sure you have caching enabled on the Monarch plugin. As far as Bloom goes, I use that too on this blog. Some plugins utilize admin-ajax.php to make calls and so you won’t be able to fix all of them unfortunately.

      Reply
        • Hi Pieter, under the general settings tab there is a “frequency of updates.” I have mine set at 3 hours to cache before grabbing updates.

          Reply
          • Thanks! I had it on 3 hours, changed it to 4 now. Also installed the Heartbeat Control with your settings. Hostgator is “caching” my website and sending emails that my load is too high. The problem started after I enabled the facebook api thing in the latest version of Monarch. Lets see if this fixed the problem! Thanks for the help.

          • Great Pieter! You might even want to change it up to 6 or more hours. For my clients I have actually started using 12 hours so that it updates twice a day. For my own site I use 3 hours, but I am on a very beefy server. The heartbeat settings can make a world of difference as well. Hopefully that will sort it out for you.

          • The cache setting in Monarch doesn’t matter. Every page where Monarch loads will have six or more POST requests to admin-ajax.php every page load. If you’re using Varnish, this will prevent it from working.

            Heartbeat Control doesn’t affect Monarch either.

            If you reduce the number of social networks, eliminate the visual counters, and don’t use the like/heart button you might get better results, but I haven’t tested it.

          • Strange, as the the cache setting fixed most of my admin-ajax.php POST requests. However I moved away from Monarch as I was consistently not impressed with speed or support.

          • It looks like the requests to admin-ajax are triggered only when you have share totals displayed and then when someone clicks on any of the Monarch buttons. The former condition (and maybe the latter also) prevents Varnish from working, so in hosting environments where Varnish bears the brunt of the load, Monarch is going to slow things down enormously with just a few dozen concurrent visitors.

  6. Hey Brian – thanks so much for this – made a HUGE difference in load speed! :) and so did the monarch settings – awesome!

    Reply
  7. Awesome! This helped me find the rogue app. I have an Amazon affiliate link generator app that has a “localization” tool (if you want to show different products to different countries). I had thought I turned it off but it turned out I had code in widgets that the plugin didn’t touch and remove. I was able to use GTMetrix to locate the exact issue and now I don’t receive the longer times due to the admin-ajax.php!

    Reply
  8. Dude, this is a miracle post. I’ve been working for three days on improving my site speed and have tried everything – most suggestions made zero difference or like 1/4 second difference. These two suggestions just carved my load time in half from 4 seconds to 2 seconds. Awesome.

    Reply
  9. Thank you! This was just what I was looking for. I found that Post View Counter was posting to admin-ajax to check if the user was signed in, and this was adding 700ms to site load.

    Reply
  10. Thanks for this article. I identified AdRotate Pro to be an issue with admin-ajax.php. I changed the group settings of my ads and the load time of 14 seconds was reduced to 3seconds!

    Reply
  11. Thank you bro… you helping me a lot… I have same problem with you at my social sharing plugin “monarch” that make my site loading almost 15s. I disable it, and my site loading just 2s. So, how to use monarch without loading speed problem??

    Reply
    • No problem man! There is an option in the settings to cache the requests. This will help with the overall load time. I personally moved away from Monarch though because even with the caching it was slower than other plugins. I recommend checking out our Novashare social sharing plugin. We developed it from the ground up with performance in mind. That’s what we are using on this site. https://woorkup.com/novashare-review/

      Reply
  12. I have been struggling for ages to try and speed up my wordpress site. From P3 plugin performance through to Super Cache I just haven’t been able to figure it out. I installed a statistics plugin which showed a huge amount of requests to load wp-admin/ajax.php. I searched and found this post, installed Heartbeat control and now my site is super fast!!! Thank you so much.

    Reply
  13. Hi Brian.

    Thanks very much for this blog post.

    Was wondering what was wrong with my wordpress site.

    Thanks again.

    Reply
  14. Great Post Man. if we use “”use default” on control heartbeat options the it will remains the same loading time. then whats the usage of heartbeat control.

    it will works fine with “always only on post edit pages”

    Kind Regards
    Rajkumar Kanagaraj

    Reply
  15. Pingback: Social Warfare Review - Ultimate Social Sharing Tool - brightkite
  16. So lets say somebody left up a window at the office which is navigating to a blog post on the admin side. Would that cause unnecessary requests like this? Would it technically be slowing down the site?

    Reply
  17. Thanks for the article.

    If i understand correctly, those admin-ajax.php calls can disrupt the load time in the frontend only when specific plugins are using it, is that correct?

    if i have a clean wordpress install with no plugins it only affects the CPU of the server while a window with the dashboard is opened and not the frontend load time ?

    Reply
  18. Hi there. I just wanted to say THANK YOU!
    Editing Pages was super slow and it was just terrible. You saved hours of lifetime and made me very happy.

    -Jan

    Reply
  19. Hey Brian,

    I installed the heartbeat plugin but when I tried to do the GTmetrix trick it showed nothing, like in your case it shows get share count, in my case it was empty and showed nothing, all blank. What should I do not?

    This is really irritating me.

    Reply
  20. Hi Brian
    Do you still need the heartbeat plugin if I use the perfmatters.io optimizing plugin to disable the heartbeat?

    Reply
    • Hey Randodo,
      No, if you’re using our Perfmatters plugin you don’t need the heartbeat plugin as we already have this feature built-in.

      Reply
  21. Hi Brian;
    Do you need to be a Pro user of GTMetrix to see and expand the POST requests and then click into the “Post” tab to see additional details? My results provided by GTMetrix only shows a screen shot that I can’t click into and the screen shot seems to be a general one instead of one specific to my site.

    Reply
    • Hey Tracy, no I only have a free GTMetrix account. Make sure you test here: https://gtmetrix.com/ and then click into the “Waterfall” tab on your test. An admin-ajax.php request should have a POST tab. I just confirmed this as well.

      Reply

Leave a Comment

23