I'm using a plugin that utilizing admin-ajax to $_POST save data as cookie. All working fine except each fetch not fast enough to complete.
So, I'm trying to replace admin-ajax to use custom admin-ajax (To gain more speed and reduce load)
Custom admin-ajax is ready and loaded. But not posting data to work. Can anyone help?
Thanks
dimadin answers:
You shouldn't do that. It still needs to load most of WordPress. What I propose is switching to REST API endpoint, it is faster because it doesn't load admin scripts. Here are benchmarks: https://deliciousbrains.com/comparing-wordpress-rest-api-performance-admin-ajax-php/
I can convert your admin-ajax to REST request but I need both callback function and JavaScript (or whatever it uses) since they need to be (a little) altered.
email889 comments:
I saw this post before I decided to get into custom admin ajax. Custom admin ajax will be much faster and maybe can better control what to load?
The plugin is only for posting drop down time and date selection purpose, can it not be using the most minimum / does it need to load everything in original admin-ajax?
If you are happy to check the demo site, please send me your email and will email you the admin details. Thanks.
dimadin comments:
If response has nothing to do with WP, you can change it, however that script should be placed outside WordPress directory, otherwise it might create problems in the long run.
You can email me to the address on my profile page.
email889 comments:
Email sent. Have you received?
dimadin comments:
Yes. Since this request doesn't touch WordPress this can be done. However, I can't do this for a few hours because I need to go outside. Also, this looks like a minor thing that is not used that much, maybe I am wrong.
email889 comments:
Please don't take long. Also, other users may already complete the task. Thank you.
Kyle answers:
If Arnav runs out of time to work on it (which I doubt will happen, he is a good dev), let me know and I can take a look