To increase better user experience, we always end up increasing site speed. Clicking a website link seems like a simple thing. But have you ever thought how many requests are instantly pinged within a few seconds after a single click? Many things happen within these few seconds that may slow down the website.
Although, there are various things behind the slow loading of the site. If checking on-site speed test tools, sometimes it shows a warning in the admin Ajax.php file. That means the Admin Ajax.php file is also one of the reasons behind the slow loading of the site.
Admin-ajax.php is part of the WordPress AJAX API. It does handle requests from both the backend and front end as well. Ajax allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes.
In WordPress 3.6, WordPress introduced Heartbeat API. The API stimulates the bidirectional connection between the browser and the server. In addition, it was used for autosave, post-locking, and log-in expiration warnings while a user was writing or editing.
Heartbeat API triggers events on receiving data/response while creating requests for communication with the server. This generally causes a huge load on the server and thus slows down the website.
Due to this Heartbeat API, Admin-ajax.php generates requests after every 15 seconds. The request can be any communication with the server. And thus, by sending too many requests, the server takes a long time to display your content or load the website.
Speed up WordPress Admin Dashboard
So, the best solution to speed up the site at the backend is to disable the Heartbeat API. Instead, install the Heartbeat control plugin. The heartbeat control plugin allows you to manage the frequency of the WordPress heartbeat API easily. Through this plugin, the heartbeat API can be disabled entirely.
If you are using any caching plugin, then disable the object cache before moving forward. It will drastically speed up the WordPress dashboard.
To Install the Heartbeat Control plugin:
- Login to your WordPress Admin Dashboard.
- Go to Plugins>> Add new and search for Heartbeat Control.
- Now, Install and Activate it.
The configuration of the Heartbeat Control Plugin:
Time needed: 1 minute
- Goto HeartBeat control plugin settings
In your WordPress dashboard, you will see the Heartbeat control option under the settings menu on the left-hand side.
- Select a location to disable the heartbeat
The locations have three options: WordPress Dashboard, Frontend, and Post Editor.
- Modify Heartbeat
Choose to modify the heartbeat option for WordPress Dashboard. It will ask you to override heartbeat frequency. Here you can set the frequency value to 60 using the slide option. With this frequency, the requests will generate after every 60 seconds. It will drastically reduce the load on the server.
- Allow Heartbeat on Post Editor
If I guess your site regularly contributes more than 1 user, I suggest selecting Allow Heartbeat on Post Editor.
- Now, search for the plugin that uses Heartbeat API.
To do so, Go to the GTMetrix site and analyze your website. Then, go to the Waterfall tab and examine which file takes a long time to connect and respond. Now, scroll down and see if there is an entry for admin-ajax.php. If yes, expand it and navigate to the Post tab to find the plugin.
- Disable Heartbeat
You can disable heartbeat on the front end if none of the plugins on your site uses it. There is no extra configuration required to disable the heartbeat.
There is one more option to sort this issue upgrade to a hosting plan that could handle the load of the requests. You can also check our tips to make your WordPress Blog Faster.
Hello sir when every i click to load more button in my site it gives 500 (Internal Server Error) Post when i check it i my console tab and give the path of wp-admin/admin-ajax.php
What to do sir
Hi Rishabh,
If you are using any security plugin, check it’s not blocking
admin-ajax.php
calls.Let me know if that works.
Thank you very much for your help. We have a project where your posts with the Newspaper theme have been helpful.
There is one item I’m not clear about. Item #6. I’ve looked at GTMetrix Waterfall…not being familiar with the information I’m looking at, not sure I’m able to figure out what you’re getting at with #6.
Any additional explanation would be helpful.
Hello Melih,
Glad, to help.
You need to follow item #6 if there is any entry for POST admin-ajax.php
The entry looks like this: http://prntscr.com/facb14