Title: Admin-ajax.php issue
Last modified: July 10, 2021

---

# Admin-ajax.php issue

 *  Resolved [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * (@txtcoke)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/)
 * Hello, I am having an issue with the plugin and admin-ajax.php
 * My site uses admin-ajax for loading ajax loaders or showing more products on 
   pages etc.
 * When I for instance press the “more products button”, where products load over
   admin-ajax, nothing happens. The loader keeps loading infinitely.
    Then I checked
   the browser console, and I saw admin-ajax.php is returning 401.
 * When I clear the plugin cache, everything starts working again, but after some
   hours, admin-ajax again is 401, and consequently, all loaders that rely on it
   don’t work, keep loading forever as I mentioned.
 * I’ve already whitelisted the path on the plugin settings, and it didn’t work.
   
   Then, I made a last check, deactivating the plugin, and finally, I could see 
   it was a plugin issue, as the error disappears completely, and things load properly
   when admin-ajax is called.
 * Why is that so?
    I love the plugin, I don’t want to stop using it. What I also
   don’t understand is why when I clear plugin cache, admin-ajax works properly,
   and shortly after (some hours), it starts again returning 401 on the browser 
   console.
 * Note: This issue never happens on the backend, when I am logged in as admin.
 * How can I solve it?
    Thank you!

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14649398)
 * [@txtcoke](https://wordpress.org/support/users/txtcoke/) Could you please try
   to purge the cache and the from WP-Optimize > Cache > Preload, click Preload 
   button to preload all the urls and check if it helps to fix the issue?
 *  Thread Starter [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * (@txtcoke)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14654551)
 * Hello I did it to test, but the behavior is the same, after some hours error 
   403 admin-ajax.php was showing up again, and nothing that relies on ajax was 
   loading…
    (Sorry in my first message I told 401, but it is 403 error)
 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14658007)
 * [@txtcoke](https://wordpress.org/support/users/txtcoke/) Have you performed a
   conflict test yet?
 * If not – first, please make a full site backup.
 * Try deactivating all plugins except for WP-Optimize and see if it is resolved.
 * If so, reactivate each plugin one at a time until you find the culprit. You can
   check for the issue between activating each plugin, so you can see which one 
   is causing problems.
 * Please let us know your findings.
 *  Thread Starter [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * (@txtcoke)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14673155)
 * Hello, that method wont work as i mentioned when cached is recently cleared issue
   is not there. So even though I activate plugin by plugin, I wont find anything
   as everything will seem to work well as the cache would be new.
    Issue happens
   some hours to a day after cache has been flushed.
 *  [Harshad](https://wordpress.org/support/users/bornforphp/)
 * (@bornforphp)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14678324)
 * [@txtcoke](https://wordpress.org/support/users/txtcoke/) 403 Forbidden usually
   occurs when your server is blocking the request, could you please check with 
   your hosting company, if they have any rules added to block the request?
 *  Thread Starter [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * (@txtcoke)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14678926)
 * Hello, I’ve already checked it with them. This path is whitelisted on server.
   
   I see it comes from the plugin as I had to change the cache plugin, and the issue
   is not happening with other cache plugins. To be honest I am very sorry because
   your plugin is the best I used and id like to continue to use it. I would appreciate
   if you could find out why it happens. I see there were other people who had same
   issue searching on the forum.. So it seems it didn’t only happen to my site. 
   Thank you
 *  [Marc Lacroix](https://wordpress.org/support/users/marcusig/)
 * (@marcusig)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-14679150)
 * Hi [@txtcoke](https://wordpress.org/support/users/txtcoke/),
 * This sounds like the ajax requests are including a `nonce`, which will expire
   after a few hours, making the request fail.
    If these requests are for non-logged
   in users and / or do not have any user-specific content, the use of a nonce doesn’t
   really make sense.
 * If you authored the code for these ajax calls, I would recommend removing the
   use of nonces, **IF the content fetched is not user specific**.
 * Otherwise you can try reducing the lifespan of the cache to a few hours.
 * Best,
    Marc
 *  Thread Starter [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * (@txtcoke)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-15024960)
 * Can I “whitelist” nonces?

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Admin-ajax.php issue’ is closed to new replies.

 * ![](https://ps.w.org/wp-optimize/assets/icon-256x256.png?rev=1552899)
 * [WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance](https://wordpress.org/plugins/wp-optimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-optimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-optimize/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-optimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-optimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-optimize/reviews/)

## Tags

 * [admin-ajax](https://wordpress.org/support/topic-tag/admin-ajax/)

 * 8 replies
 * 5 participants
 * Last reply from: [txtcoke](https://wordpress.org/support/users/txtcoke/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/admin-ajax-php-issue-3/#post-15024960)
 * Status: resolved