Diagnosing high admin-ajax.php usage is a widespread scenario when dealing with WordPress or WooCommerce.

The admin-ajax.php file is used by both CONJ and its companion (PowerPack) plugin, as well as many others, to perform common actions in your shop, such as applying a discount code, validating the checkout, completing a purchase.

Use the suggestions below to help track down the problem and get it resolved and note that the error is generally caused by third-party plugins or from frequent non-cacheable admin dashboard requests, due to the Heartbeat API, such as auto-saving drafts.

It is important though that you diagnose high admin-ajax.php spikes when you see them, as they have been known to bring a site to a crawl.

Plugin conflicts

Some plugins are known to block access to admin-ajax.php intentionally. The following types of the plugin are often responsible:

  • Security plugins — these plugins often have a setting that disables admin-ajax.php, or a similar setting for blocking access to admin files.
  • Plugins that disable /wp-admin/ access for non-administrators.
  • Minification plugins — These plugins make performance improvements by shrinking the size of JavaScript and other static resources in both theme and plugins. The process often breaks the JavaScript files in CONJ that is responsible for communicating with admin-ajax.php file properly.
  • Caching plugins — Occasionally caching plugins can cause problems with admin-ajax.php by either breaking the JavaScript that creates the Ajax requests or by simply making admin-ajax.php file inaccessible.

If Ajax is not working on your site properly and you have any plugin that matches the descriptions above, try deactivating the plugins and then testing to see if admin-ajax.php becomes accessible again. If it does, then you may still be able to use the plugin, you will just need to find the problematic setting in the plugin and disable it.

Firewalls

Occasionally, service provider (hosting) companies will set up a firewall on your site that is intended to protect your site, but that also has the adverse effect of blocking access to admin-ajax.php.

If you are having trouble with Ajax, check if your host has a firewall and ask them to disable it temporary. If Ajax begins working after disabling the firewall, you have found the culprit. If Ajax is still inaccessible after disabling the firewall, you can safely re-activate it.

Rules in .htaccess file

The .htaccess file used on Apache servers can sometimes include special rules that are designed to protect your site from attacks. Some times these rules are applied little generic and unintentionally disable access to admin-ajax.php.

If your Ajax is not working, check to see what rules your .htaccess file contain. If there are any rules beyond those shown below, remove them and see if Ajax begins working again.

Your .htaccess file will usually contain rules that look like below:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

NGINX configuration

Sometimes the admin-ajax.php file is inaccessible due to misconfiguration of the NGINX environment. You could ask your service provider support to add the following line to the nginx.conf file:

add_header ‘Access-Control-Allow-Origin' ‘*';

Cross domain issues

The admin-ajax.php file must be run on the same domain from which it’s called.

As an example in case your site is https://www.example.com and you try to call https://example.com/wp-admin/admin-ajax.php it won’t work as expected.

Note the www in the first URL, and NO www in the second address.

This is also true with an SSL mismatch in web address.

As an example in case your site is https://www.example.com and you try to call http://www.example.com/wp-admin/admin-ajax.php it won’t work as expected.

Note the https in the first URL, and NO https within the second address.

As mentioned above there are some quick and easy options to both diagnose and resolve admin-ajax.php issues. Typically they arise from third-party plugins that might be conflicting with one another or are perhaps badly coded.

If you are experiencing CPU load on the back-end as a result of admin-ajax.php, you might also want to consider a managed WordPress host who is more experienced in dealing with these types of performance issues.

Privacy and maintenance modes

Some hosts like Pantheon and Flywheel have this privacy or maintenance mode settings that allow you to prevent access from visitors without a password or other access. In some cases, this can prevent CONJ from communicating properly with Ajax.

Last updated: 3 weeks ago

We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies ― Learn more

Accept