Sửa lỗi load wp-admin admin-ajax.php 404 not found

Lỗi “Failed To Load Resource” là một trong những vấn đề khó chịu nhất mà nhiều người sử dụng WordPress đã gặp phải trong thời gian gần đây.

Lỗi này khá khó để sửa vì nó có thể được gây ra bởi các vấn đề khác nhau như cài plugin không tương thích và lỗi HTTPS và nhiều hơn nữa.

Trong bài này, chúng ta hãy xem xét một số các nguyên nhân đằng sau lỗi này và cung cấp một vài giải pháp khả thi để sửa chữa nó.

Sau khi tìm hiểu, chúng tôi nhận thấy rằng nhiều người sử dụng WordPress đã gặp lỗi “Failed To Load Resource” theo nhiều cách khác nhau. Một số đã tìm thấy lỗi trong giao diện , một số người đã nhìn thấy lỗi trong bảng quản trị WordPress của họ, và một số người khác đã bắt gặp vấn đề trong khi thực hiện các hành động như tải các tập tin media.

Như bạn đã biết, hệ thống lõi WordPress, plugins và theme chạy trên các kịch bản PHP. Những kịch bản gửi các yêu cầu để giao tiếp với các nguồn tài nguyên được lưu trữ trên máy chủ của bạn. Khi một cái gì đó gây trở ngại cho những yêu cầu này, WordPress không lấy được tài nguyên. Do đó sẽ phát sinh lỗi “Failed To Load Resource”.

Có nhiều lý do khác nhau để xảy ra lỗi “Failed To Load Resource”. Sử dụng các plugin hoặc chủ đề đã lỗi thời, vấn đề cấu hình URL, và plug-in tương thích là một số trong những thủ phạm phổ biến nhất gây ra lỗi.

Dưới đây là một vài phương pháp bạn có thể thử để sửa chữa nó.

Nếu bạn đã gặp phải lỗi “Failed To Load Resource” với mã trạng thái 400, như thế này: “Failed to load resource: the server responded with a status of 400 () /wp-admin/admin-ajax.php”

Điều này, thường có nghĩa là một trong hai địa chỉ URL của tài nguyên đã được thay đổi hoặc một plugin WordPress đang ngăn truy cập vào các tập tin cụ thể. Trong hầu hết các trường hợp, một plugin antivirus có thể ngăn WordPress truy cập vào một số tập tin mà nó nghĩ là đáng ngờ.

Nếu bạn có cài bất kỳ plugin chống virus hoặc tường lửa được cài đặt trên trang web WordPress của bạn, hãy thử tắt chúng.

Các lỗi cũng thường được gây ra bởi các vấn đề về plugin không tương thích. Để xem các lỗi gây ra bởi một plugin nào , bạn có thể thử vô hiệu hóa tất cả các plugin trên trang web WordPress của bạn. Sau đó, kích hoạt các plugin từng cái một & mỗi lần làm mới trang để phát hiện plugin gây lỗi.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

Một vài người dùng WordPress đã phàn nàn về lỗi “Failed To Load Resource” xuất hiện trong Chrome Developer với thông báo “the server responded with a status of 404”.

Hầu như tất cả các vấn đề này là do người dùng cài giao diện hoặc một plugin đã lỗi thời. Cập nhật phiên bản vá mới nhất của plugin sẽ có thể khắc phục lỗi.

Trong hầu hết các trường hợp, lỗi chỉ xuất hiện sau khi cài đặt chứng chỉ SSL và chuyển đổi các URL từ HTTP thành HTTPS.

Chuyển đổi sang sử dụng SSL có nghĩa là sẽ có thay đổi đến các URL. Thỉnh thoảng, hệ thống WordPress và plug-in có thể bị nhầm lẫn về việc truy cập tài nguyên với giao thức HTTP cũ hoặc HTTPS.

Đối với một số người dùng, vẫn để URL cũ ở bước cài đặt WordPress. Lúc này bạn cần phải thay đổi URL sang giao thức HTTPS.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

Cảnh báo: Thay đổi URL cài đặt WordPress mặc định có thể làm cho trang web của bạn không hoạt động nếu không được cấu hình đúng. Chúng tôi khuyên bạn nên tham khảo ý kiến ​​một chuyên gia về WordPress hoặc nhóm hỗ trợ kỹ thuật máy chủ web của bạn để được giúp đỡ.

Kể từ khi lỗi này xuất hiện dưới nhiều hình thức, rất khó để đưa ra một giải pháp chính xác đảm bảo cho tất cả các tình huống. Nếu các giải pháp trên không giúp bạn khắc phục vấn đề này, hãy liên hệ đến dịch vụ máy chủ web của bạn và nhóm hỗ trợ khách hàng hoặc tham khảo ý kiến ​​một nhà phát triển WordPress có kinh nghiệm.

Nếu bạn thấy bài viết này hữu ích, hãy chia sẻ với bạn bè bằng cách nhấn nút chia sẻ ở bên dưới. Theo dõi chúng tôi trên Twitter và Facebook

Asynchronous JavaScript and XML (AJAX) is a set of web development techniques that enhances a website’s user experience and interactivity.

WordPress theme and plugin developers commonly implement AJAX to create dynamic and interactive features. Moreover, AJAX allows site visitors to submit a newsletter form or comment on a blog post without reloading the web page.

WordPress is a content management system (CMS) that utilizes the admin-ajax.php file to manage AJAX requests.

The admin-ajax.php file enhances the website user experience. However, too many requests can impact performance. In this article, we will share troubleshooting methods to reduce your site’s admin-ajax.php file usage.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

What Is the admin-ajax.php File in WordPress?

The admin-ajax.php file is a WordPress core file. It serves as an endpoint for handling AJAX calls or requests, such as loading comments and processing form submissions. This PHP script processes web server data and returns relevant information to users’ web browsers. By default, the admin-ajax.php file is located in the wp-admin folder.

How Can admin-ajax.php Slow Down Your WordPress Site?

The following are several factors that may cause an overload in WordPress AJAX requests:

Excessive Plugin Usage

Plugins often require additional resources and code to fully operate. Using too many plugins that rely on AJAX requests can lead to excessive usage of the admin-ajax.php file, resulting in a slower page load time.

High Traffic Volume

A website with heavy traffic can eventually cause the admin-ajax.php file to overload. This is because WordPress uses the PHP file to establish a connection between your website’s front and back end.

Inefficient Database Queries

Database queries retrieve and update WordPress site information from the back end. However, these queries can lead to high usage of the admin-ajax.php file if not optimized.

Why Is It Important to Reduce WordPress Admin AJAX Requests?

Reducing the high load of admin-ajax.php in WordPress can bring benefits to your site, such as:

Improved Performance

Minimize AJAX requests to reduce server response time. This results in faster page load times and a smoother browsing experience for your WordPress website visitors.

Enhanced User Experience

An optimized Admin AJAX file lets your website respond quickly to user interactions. Therefore, visitors can seamlessly navigate through your web pages, interact with buttons and forms, and access content. A positive user experience boosts engagement, returning visitors, and conversion rates.

Reduced Server Load

Reducing the number of admin-ajax.php requests can boost the server load, making your website accessible and responsive during high-traffic times.

You can also minimize server resources, such as processing power, memory, and storage space, so the website can handle traffic more effectively. This is especially helpful when running sites on a shared hosting plan.

How to Troubleshoot the admin-ajax.php Issue

In the following sections, we will use GTmetrix and Chrome Developer Console to identify if the admin-ajax.php file slows down your website.

GTmetrix

GTmetrix is a web-based tool used to monitor and analyze site performance. It measures various performance metrics and provides insights to fix or improve them.

The following are the steps to identify issues related to the admin-ajax.php file:

  1. Go to the GTmetrix homepage and type your website URL in the required field.
  2. Click the Test your site button to run the performance check. Note that the process varies depending on the size of your website.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

  1. Once finished, navigate to the Waterfall tab on the Latest Performance Report page.
  2. Search for admin-ajax.php using the search bar. For instance, the following performance report shows that the POST admin-ajax request takes longer than other requests.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

  1. Click POST admin-ajax.php and navigate to the Post tab. The example below shows that the count_hit script causes the performance issue. ![POST admin-ajax.php showing the Post tab ](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2019/02/post-admin-ajax-post-tab.webp)

Chrome Developer Console

Another method to diagnose your site’s Admin AJAX usage is by using Chrome Developer Console. Follow the steps below:

  1. Visit your website via Google Chrome.
  2. Right-click on the page, such as your homepage, and click Inspect. Alternatively, click the three dots icon on the top-right corner of the screen, and go to More tools → Developer tools.
  3. Click on the Network tab and reload your website.
  4. In the filter box, type admin ajax to see if any process uses a WordPress AJAX call.

How to Reduce High Usage of Admin AJAX in WordPress

After identifying the admin-ajax.php file usage issue using GTmetrix or Google Chrome Console, implement the following methods to minimize the PHP file usage:

Disable WordPress Plugins

Since WordPress plugins frequently use AJAX calls, disabling them is the easiest way to solve the issue. Especially if you have identified that a particular WordPress plugin sends unnecessary AJAX requests. The following are the steps to deactivate it:

  1. Log in to your WordPress dashboard.
  2. Go to Plugins → Installed Plugins.
  3. Locate the plugin you want to disable and click the Deactivate button.
  4. Run a performance check using GTmetrix to see if the issue is solved.

If you cannot find which plugin is overloading the admin-ajax.php file, consider deactivating all plugins and running performance testing. Then, re-activate the plugins one by one if it doesn’t cause any problems. We highly recommend backing up your WordPress website first to avoid unexpected errors.

Enable Website Caching

Caching is crucial as it helps speed up your WordPress site. It involves creating a static version of your web pages and storing them in the visitors’ browsers or servers. The cached web pages are used when returning visitors access your website, making the page load faster.

WordPress has several caching plugins to help mitigate the impact of admin-ajax.php requests and optimize website performance:

  • W3 Total Cache – reduces load and server response times by integrating advanced techniques, such as browser caching, CDNs, and CSS and JavaScript file minification.
  • WP Super Cache – generates static HTML files from dynamic web pages and accelerates page load times using various caching options, such as Apache mod_rewrite, PHP, and legacy caching.
  • WP Rocket – improves site performance by incorporating various caching mechanisms, like lazy loading, object caching, and GZIP compression.
  • LiteSpeed Cache – Designed for WordPress websites running on LiteSpeed web servers. It includes features such as QUIC.cloud CDN cache, Heartbeat control, and image optimization.

To demonstrate, we will share the steps to configure and use a caching plugin. We will use W3 Total Cache as the example:

  1. From the WordPress dashboard, install and activate the W3 Total Cache plugin.
  2. Once activated, navigate to Performance → Dashboard. Follow the W3 Total Cache setup guide.
  3. Click the Test Page Cache button on the Page Cache screen. Wait until the process is complete.
  4. Choose the best page caching option. We recommend choosing the one with the Recommend label. In this case, let’s select Disk: Enhanced.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

  1. Run the database cache check by clicking the Test Database Cache button. By default, this feature is disabled. You can also choose a database caching option from the list. The plugin recommends Redis or Memcached. ![W3 Total Cache showing the Database Cache page ](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2019/02/w3-total-cache-database-cache-page-1024x582.webp)
  2. On the Object Cache page, click the Test Object Cache button. Wait until the process is finished.
  3. Choose the best object cache result. For instance, we will select the Disk option since it receives the fastest response time. ![W3 Total Cache showing the Browser Cache screen with the Enabled setting highlighted ](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2019/02/w3-total-cache-browser-cache-screen-1-1024x582.webp)
  4. On the next screen, click the Test Browser Cache button to perform the browser cache check. By default, the setting is set to the Enabled option. ![The W3 Total Cache plugin showing the Object Cache page with the Disk option highlighted ](https://www.hostinger.com/tutorials/wp-content/uploads/sites/2/2019/02/w3-total-cache-object-cache-page-2-1024x583.webp)
  5. Enable the image optimization feature on the Lazy Load page by ticking the Lazy Load Images radio button.
  6. Review your W3 Total Cache settings and click the Dashboard button to complete the setup.

Hostinger hosting plans, including Business Web Hosting and Cloud Startup, have Object Cache and Cache Manager features. These built-in features automatically enable caching on your site, resulting in faster page load speed.

However, you must manually turn on Cache Manager using hPanel. Here are the steps:

  1. Log in to your Hostinger account and go to the Websites page.
  2. Select your website and click Manage.
  3. On the hPanel dashboard, navigate to Advanced → Cache Manager. Alternatively, use the search bar and type cache manager.
  4. Activate the feature by toggling on the Automatic cache option.

Sửa lỗi load wp-admin admin-ajax.php 404 not found

Sửa lỗi load wp-admin admin-ajax.php 404 not found

Control WordPress Heartbeat API

WordPress Heartbeat API is a feature that allows real-time communication between a web browser and the server using AJAX requests.

However, its frequent requests can sometimes lead to high resource usage, increased server load, and heightened use of the admin-ajax.php file.

You can control WordPress Heartbeat API using two methods:

Using the LiteSpeed Cache Plugin

LiteSpeed Cache is a powerful plugin with various features, including Heartbeat Control. The following are the steps to configure this plugin to limit Heartbeat API usage:

  1. Log in to your WordPress dashboard.
  2. Install and activate the LiteSpeed plugin.
  3. From the sidebar menu, navigate to LiteSpeed Cache → Toolbox → Heartbeat. By default, the Heartbeat Control feature settings are disabled.
  4. Turn on an option and modify the Backend Heartbeat TTL value to your preference. For instance, enable the Backend Heartbeat Control and set the Backend Heartbeat TTL value to 15.
  5. Save the changes.

Modifying the function.php File

Another way to limit or disable Heartbeat API is by adding custom PHP code into the function.php file. Follow the steps below:

  1. From the WordPress dashboard, navigate to Tools → Theme File Editor.
  2. Go to the Theme Files section and select Theme Functions, which contains the function.php file.
  3. Copy and paste the following code snippet to the text editor:

add_action( 'init', 'disable_heartbeat', 1 ); function disable_heartbeat() { wp_deregister_script('heartbeat'); }

  1. Click Update File to save the changes.

Conclusion

The admin-ajax.php file’s high usage in WordPress may significantly cause performance issues. Therefore, it is important to address this problem to improve your site’s performance, enhance user experience, and reduce server load.

In this article, we have discussed factors that lead to high usage of admin-ajax.php, such as excessive plugin usage, high traffic volume, and inefficient database queries.

You have also learned how to troubleshoot this AJAX script file issue using GTmetrix and Chrome Developer Console.

As for reducing the high usage of your WordPress site’s admin-ajax.php, here is a recap of the three methods:

  1. Disable WordPress plugins.
  2. Enable website caching.
  3. Control WordPress heartbeat API.

We hope this article has helped you understand how to reduce the high usage of admin-ajax.php on your WordPress site. Good luck on your online journey!

Sửa lỗi load wp-admin admin-ajax.php 404 not found

Information Technology and web development are Yoga's passions. He loves nothing more than sharing his experience with readers, and helping them to understand the world of IT. In his spare time, Yoga likes to make music and learn to code. He is always looking for new challenges, and enjoys pushing himself to learn new things.