If you’re a coder or advanced WordPress user, you’ve probably come across the term “robots.txt”.
Most websites will automatically include this file type within its code, and almost one hundred percent of the time, it’ll be set to “allow”.
I remember when I ran into this issue when I was a novice WordPress user and wanted to share my opinion on should you allow or disallow “/wp-admin/admin-ajax.PHP” in WordPress.
The code “/wp-admin/admin-ajax.PHP,” or known as the “admin-ajax.PHP” file, is automatically added to your code and allows the connection between the client (i.e. a Google Bot, Bing Bot) and your hosting (server) by using AJAX. So, should you allow or disallow “/wp-admin/admin-ajax.PHP” in WordPress? If you’d like your website to appear in search, yes, you should allow it.
By allowing this code, you’re essentially granting Google access to crawl your CSS, J.S, and Ajax files.
This is a crucial SEO procedure, and failing to allow Google or any other search engine to crawl your site, may be hurting your rankings.
Coding is a scary place, and it can seem daunting to tinker with.
But it doesn’t have to be that way, as long as you take good advice from industry experts.
Below, we go into detail on how to fix a common admin-ajax.PHP file issue and more about the mysterious “robots.txt” file.
How to Fix Excessive admin-ajax.PHP Usage
A prevalent issue that people run into that involves admin-ajax.PHP is its over-usage.
For example, when you’ve got multiple WordPress dashboards open at one time, you’ll notice that the CPU load will rapidly increase in your cPanel account.
A way in which you’re able to identify if you’re experiencing these high levels of CPU load is through WordPress server requests.
If you examine the server’s requests when your WordPress editor is open, you’ll see an automated API that looks similar to the below.
[00:15:30] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:15:45] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:16:00] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:16:15] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:16:30] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:16:45] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
[00:17:00] nctest.info POST /wp-admin/admin-ajax.php HTTP/1.0
This script “admin-ajax.PHP” in the coding and development world can also be known as WordPress’s Heartbeat.
As worrying as that may sound, it’s not as bad as it may seem.
It just extends your WordPress session for simpler use to the administrative panel.
If you power the editor or administrator regularly, this will eliminate you’re having to re-enter your password time and time again.
Most of the time, the admin-ajax.PHP file is responsible for a dramatic increase in both physical memory and CPU consumption.
This is because of the frequency (every fifteen seconds) of database calls and other requests that come with it.
Having an increased amount of database calls can cause your editor to slow.
However, now you know a small amount about why and what this issue is. Let’s discuss how you’re able to fix it.
The best way to decrease the load on your current WordPress account is by downloading an application called “WordPress Heartbeat API”.
This is widely used within the community, and with this plugin, you’ll be able to control the occurrence of the AJAX calls that we’ve mentioned above.
PRO TIP – This application may make some changes to your website. Before adding any plugin’s make sure you generate a complete backup of your website.
- First, head over to your WordPress admin dashboard and make your way over to the “Plugins menu”, select “Add New”, and search for “Heartbeat Control”, this will now bring up the appropriate plugin.
- Once you’ve located the “Heartbeat Control” plugin, click the activate button.
- Now you’ve activated this, head over to the app by clicking on “Settings” then “Heartbeat Control Menu”.
- When you’re in the application, in the “general settings” area, click the circle next to “Modify heartbeat” to the right of each setting. When you’ve done this, set the “Override Heartbeat frequency” to 60+.
You’re now set up. If you want to disable the Heartbeat plugin at any time, you’re able to achieve this by heading over to “General settings” then “Disable Heartbeat”.
However, remember that disabling the Heartbeat plugin after use may disturb the functionality of some aspects of WordPress. If you were to run into this issue, just adjust the Location settings or alternatively reactivate Heartbeat and set it to a higher frequency than 60.
Although we’ve explained how you’re able to fix this excessive use of admin-ajax.PHP, if you’re the only editor for your site, then you may want to look further into this.
Typically, this will only give you high CPU levels if multiple tabs are opened on one editor.
If you’re the only editor, this could be occurring due to a recent plugin you’ve installed or your current WordPress theme.
The easiest way to find out what’s causing the issue is by deactivating each one, one at a time to find out what’s causing this problem. If you’re going to investigate this, make sure you turn the Heartbeat app off for accurate results.
What is a Robots.txt?
As mentioned above, the admin-ajax.PHP source is part of a robots.txt file.
But what does this mean? What’s the importance of this file type?
Well, as suggested by the file name “robots”, it’s related to internet bots.
A typical bot that will crawl your website is from search engines, such as Google.
This helps identify your website through HTML, CSS, J.S, and Ajax files.
So, before you hop on the growing trend that bots are bad, think again because these help you rank your website on search engines.
But don’t get me wrong, there are bad bots that float around on the internet, and that’s why the robots.txt was created.
Bots are easy to create and manipulate, and therefore back in the mid-1990s, they created a robots exclusion standard to ensure that bots don’t just magically appear and override websites.
You can probably see where this is going, and to implement this standard like this the robot.txt was created to control the situation.
In simple words, this file blocks or gives specific bots access that it’s been programmed into allowing.
Should You Care About Your Robot.txt File?
Yes, you most definitely should, as it can benefit your website in many different ways. Let me explain to you how.
First, and most importantly, it helps with optimizing for search engines.
With a robot.txt file, you’re able to suggest to the search engine crawler which pages they should crawl for content and not.
This will ensure that you notify bots that you want them to crawl certain web pages because they’re more important.
After all, the more information you can provide to a search engine bot about your website, the higher chance you’ll rank.
Secondly, due to the robot.txt file blocking some bots that float across the internet, it dramatically decreases bots overpowering your website and wasting important resources.
Having reduced wastage levels will ensure your CPU levels are low, and your website runs smoothly throughout.
Hope the information was of use to you, remember to check out our home page for more cool stuff Online tool guides.