How to fix high usage of admin-ajax.php in WordPress

Asynchronous JavaScript and XML ( AJAX ) is a set of Web development technologies that enhance the user experience and interactivity of Web sites.

WordPress theme and plugin developers often use AJAX to create dynamic and interactive features. In addition, AJAX allows site visitors to submit newsletter forms or comment on blog posts without reloading the page.

WordPress is a Content Management System (CMS) that utilizes theadmin-ajax.phpfile to manage AJAX requests.

admin -ajax.phpFiles enhance the website user experience. However, too many requests can affect performance. Therefore, we will share tips to reduce websiteadmin-ajax.phpTroubleshooting methods for document usage.

图片[1]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

What is the admin-ajax.php file in WordPress?

admin -ajax.php File is a WordPress core file. It acts as an endpoint for handling AJAX calls or requests, such as loading comments and handling form submissions. The PHP script processes web server data and returns information to the user's web browser. By default, theadmin-ajax.phpThe file is located in thewp-adminfolder.

admin-ajax.php How to slow down your WordPress site?

Here are a few factors that can cause WordPress AJAX request overload:

  • Excessive use of plug-ins

Plugins often require additional resources and code to be fully operational. Using too many plugins that rely on AJAX requests can lead to overuse of the admin-ajax.php file, which can result in slower page load times.

  • high flow

Highly visited websites may face a problem: the admin-ajax.php file is under too much pressure. The root of this problem is that WordPress uses this PHP file to help communicate between the front-end of the site (that's the part that users see) and the back-end (the admin area of the site). Simply put, when the site is busy, this file can become less efficient by handling too many requests.

Database queries are the way the backend of a website gets and updates information about the WordPress site. However, if these queries are not properly optimized, they can lead to overloading of the admin-ajax.php file, which in turn affects the performance of the site.

Why should I reduce the load of WordPress admin-ajax.php?

图片[2]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Reducing the reliance on admin-ajax.php has multiple benefits for your site, including:

  • Improve performance: By minimizing AJAX requests, you can reduce server response time, which speeds up the speed at which your WordPress site loads pages for visitors and makes the browsing experience smoother.
  • Enhanced user experience: A well-optimized admin-ajax.php file enables a website to respond faster to user actions such as page views, button clicks and form submissions. This not only improves user satisfaction, but also helps increase user engagement, return visits and conversions.
  • Reduce server load: Reducing the number of requests to admin-ajax.php can help reduce server stress and keep your website responsive even during high traffic periods. This is especially important when using a shared hosting service to help you utilize your limited server resources such as CPU, memory and storage space more efficiently.

How to fix admin-ajax.php?

We can utilize tools such as GTmetrix and Chrome Developer Console to diagnose whether admin-ajax,php is slowing down the site. With these tools, we are able to identify which AJAX requests have the biggest impact on performance and look for ways to reduce them or optimize the way they are handled. With careful analysis and appropriate optimization measures, you can significantly improve the overall performance and user experience of your website.

This can mean that certain plugins, themes or custom code is overusing admin-ajax.php and causing a performance degradation on your website. With GTmetrix you can see in detail which specific requests are causing the problem and take steps to optimize accordingly.

How to recognize admin-ajax.php issues using GTmetrix:

  • Visit the GTmetrix homepage: First, open the GTmetrix website and find the input box on the home page.
图片[3]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
  • Enter your website URL: Enter the address of the website you want to test in the required fields.
  • Operational performance testing: Click the "Test Your Site" button to begin the analysis. The length of this process will vary depending on the size and complexity of your site.
  • View Waterfall Chart: Once the analysis is complete, go to your performance report and click on the "Waterfall" tab. This shows detailed information about each request as the site loads.
  • Search admin-ajax.php: Type admin-ajax.php in the search field of the waterfall graph to find out which requests are related to it. Comparing the load times of these requests can help you identify performance bottlenecks.
图片[4]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
  • Analysis of specific requests: Click on the specific POST admin-ajax.php request and go to the "Post" tab. Here you can see the specific script that is causing the performance issue, such as the count_hit script in the example above.
图片[5]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

By following these steps, GTmetrix can help you identify performance issues caused by admin-ajax.php and provide clues as to what may be the solution. After identifying the issue, you may need to further examine the plugin, theme, or custom code that is causing these requests and consider optimizing or replacing it to improve site performance.

Chrome Developer Console

Another way to diagnose your site's administrative AJAX usage is to use the Chrome Developer Console. Follow the steps below:

  1. Access your website via Google Chrome.
  2. Right-click on a page (such as your home page), and then click theprobe. Alternatively, click the top right corner of the screenThree dot icon and go toMore toolsDeveloper ToolsThe
  3. click (using a mouse or other pointing device)"Network."tab and reload your site.
  4. In the Filter box, typeadmin ajaxto see if any processes are using WordPress AJAX calls.

How to Reduce High Usage of Managing AJAX in WordPress

Determine using GTmetrix or Google Chrome Consoleadmin-ajax.phpAfter the file usage issue, implement the following methods to minimize PHP file usage:

Disable WordPress Plugin

Since WordPress plugins often use AJAX calls, disabling them is the easiest way to solve the problem. Especially if you find that a particular WordPress plugin is sending unnecessary AJAX requests. Here are the steps to disable it:

  1. Log in to your WordPress dashboard.
  2. switch toplug-in (software component)Installed plug-insThe
  3. Locate the plug-in you want to disable, and click"Deactivate."Button.
  4. Use GTmetrix to run a performance check to see if the issue has been resolved.

If you can't find which plugin is overloadingadmin-ajax.phpfile, please consider deactivating all plugins and running a performance test. Then, if there are no issues, reactivate the plugins one by one. We strongly recommend that you backup your WordPress site first to avoid unexpected errors.

Enable site caching

Caching is crucial because it helps speed up your WordPress website. It involves creating static versions of web pages and storing them in the visitor's browser or server. When a returning visitor accesses your site, the cached page will be used, resulting in a faster loading page.

WordPress has several caching plugins that can help alleviate admin-ajax.phpimpact of requests and optimize site performance:

  • W3 Total Cache - Reduce load and server response times by integrating advanced technologies such as browser caching, CDNs, and CSS and JavaScript file shrinking.
  • WP Super Cache - Generate static HTML files from dynamic pages and use various caching options (e.g. Apache mod_rewrite, PHP, and legacy caching) to speed up page load times.
  • WP Rocket - Improve site performance by incorporating various caching mechanisms such as deferred loading, object caching, and GZIP compression.
  • LiteSpeed Cache- Designed for WordPress sites running on the LiteSpeed web server. IncludesQUIC.cloud CDNCaching, heartbeat control, image optimization and more.

Let's take W3 Total Cache as an example:

  1. From the WordPress dashboard, install and activate theW3 Total CachePlug-ins.
  2. After activation, navigate toperformancesinstrument panelsPlease follow the W3 Total Cache Setup Guide. Follow the W3 Total Cache Setup Guide.
  3. Click on the Page Cache screen on the"Test page caching"button. Wait for the process to complete.
  4. Choose the best page caching option. We recommend choosing the page caching option with"Recommended."labeled products. In this example, we chooseDisk:EnhancedThe此图片的 alt 属性为空;文件名为 1711981704753.png
  5. click (using a mouse or other pointing device)"Test databaseCache" button to run a database cache check. By default, this feature is disabled. You can also select the Database Cache option from the list. The plugin recommendsRedismaybeMemcachedThe
图片[6]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
  1. On the Object Cache screen, click the"Test Object Cache"button. Wait for the process to complete.
  2. Select the best object caching result. For example, we will choose "Disks."option because it has the fastest response time.
图片[7]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

8. On the next screen, click the"Testing Browser Cache"button to perform a browser cache check. By default, this setting is set to"Enabled"Options.

图片[8]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应
  1. By checking the box "Delayed image loading"radio button to enable image optimization on the Delayed Loading page.
  2. Check your W3 Total Cache settings, and then click theinstrument panelsbutton to complete the settings.

Hostinger hosting plans (including Business Web Hosting and Cloud Startup) come withobject cacherespond in singingCache ManagerFeatures. These built-in features automatically enable caching on your site to improve page load speeds.

However, you must manually open the cache manager using hPanel. The steps are as follows:

  1. Log in to your Hostinger account and go tonodePage.
  2. Select your website and click"Management"The
  3. On the hPanel dashboard, navigate to theAdvanced → Cache Manager. Alternatively, use the search bar and typeCache ManagerThe
  4. By switching theautomatic cachingoption to activate the feature.
图片[9]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Controlling the WordPress Heartbeat API

The WordPress Heartbeat API is a feature that allows real-time communication between web browsers and servers using AJAX requests.

However, its frequent requests can sometimes lead to high resource utilization, increased server load, andadmin-ajax.phpIncreased utilization of documents.

You can control the WordPress Heartbeat API in two ways:

You can use theHeartbeat ControlThe plugin controls how often the Heartbeat API sends callbacks to the server.

After installing and activating the plugin, go toSettings -> Heartbeat Control Settings. Here you can set it up for the API.

  • heartbeat behavior- Allows you toEnable Heartbeat,Disable HeartbeatmaybeModify heartbeat
  • placement- Determine from which region you want to control the API; it gives you three options:WordPress Dashboard,Frontendrespond in singingPost Editor
  • frequency- The number of times you are allowed to call back for each identified location. The range of values is 15 to 300 seconds
图片[10]-如何解决 WordPress 中 admin-ajax.php 的高使用率-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

Modify the function.php file.

Another way to limit or disable the Heartbeat API is to add custom PHP code to thefunction.phpfile. Please follow the steps below:

  1. From the WordPress dashboard, navigate to"Tools" → "Theme file editor"The
  2. switch toTheme Filessection and selectTheme FunctionsThe following is a summary of the information contained in thefunction.phpDocumentation.
  3. Copy and paste the following code snippet into a text editor:
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
wp_deregister_script('heartbeat'); }
}
add_action( 'init', 'stop_heartbeat', 1 ); function stop_heartbeat() { wp_deregister_script('heartbeat'); }
  1. click (using a mouse or other pointing device)Updated documentsto save the changes.

summarize

admin -ajax.phpHigh usage of files in WordPress can cause serious performance issues. Therefore, resolving this issue is important to improve site performance, enhance user experience and reduce server load.

In this paper, we discuss the factors that lead toadmin-ajax.phpHigh usage factors such as excessive plugin usage, high traffic and inefficient database queries.

Learned how to resolve this AJAX script file issue using GTmetrix and the Chrome Developer Console.

For reducing WordPress websiteadmin-ajax.phpof high usage, three methods are summarized here:

  1. Disable the WordPress plugin.
  2. Enable site caching.
  3. Controls the WordPress Heartbeat API.

Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
Author: xiesong
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments