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. Show
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. 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. 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. 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 UsagePlugins 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 VolumeA 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 QueriesDatabase 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 PerformanceMinimize 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 ExperienceAn 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 LoadReducing 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 IssueIn the following sections, we will use GTmetrix and Chrome Developer Console to identify if the admin-ajax.php file slows down your website. GTmetrixGTmetrix 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:
Chrome Developer ConsoleAnother method to diagnose your site’s Admin AJAX usage is by using Chrome Developer Console. Follow the steps below:
How to Reduce High Usage of Admin AJAX in WordPressAfter 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 PluginsSince 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:
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 CachingCaching 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:
To demonstrate, we will share the steps to configure and use a caching plugin. We will use W3 Total Cache as the example:
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:
Control WordPress Heartbeat APIWordPress 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:
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:
add_action( 'init', 'disable_heartbeat', 1 ); function disable_heartbeat() { wp_deregister_script('heartbeat'); }
ConclusionThe 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:
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! 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. |