How to find which plugin calls admin-ajax.php
Some plugins use AJAX requests to launch a custom wp_query in order to show it in the page without a complete reloading, which is a good method for displaying dynamic content on a cached page.
This AJAX request is sent to a dedicated WordPress AJAX file:
https://example.com/wp-admin/admin-ajax.php
But sometimes these queries significantly increase your load time , especially when there are several:
Note: When admin-ajax.php calls are initiated from within JavaScript, you may be able to reduce the performance impact by using the Delay JavaScript Execution feature
Find plugin(s) generating AJAX requests
You have a few plugins
If you only use a few plugins then you can do the following:
- Deactivate the first plugin.
- Clear WP Rocket's cache.
- Test your website here: https://tools.pingdom.com/
- Check if the admin-ajax.php query is still there.
- If it is still there, re-activate your plugin and repeat step 1 with the next plugin.
You have a lot of plugins
If you have a lot of plugins - or you do not want to disable your plugins - you will have to go through the Chrome console.
- Open Developer Tools. You do that either by right-clicking and choosing Inspect Element, or at the top of the window go to: View→Developer→Developer Tools.
- Click on Network tab and reload your page. You should see scrolling loading your resources like this:
- Go to the top left of the console in the Filter search box (just below the red dot) and enter admin-ajax, the list of culprits should be displayed
- Then select the one you want and check its information like this:
- When you view the Form Data and Preview, you will find some clues as to which plugin is generating this request. The action or result often includes the initials or a reference to the related plugin. In this example, we found "update_views_ajax" action and "WPP" which indicate an AJAX query of WP Popular Posts plugin.
- Test if it is actually this plugin using Method A if you wish.
Found those plugin(s), what now?
Sometimes the solution is to activate a plugin option avoiding this query, if not, you can contact the plugin developer to find a fix to reduce the loading time of this query.