ClassicPress PetitionsClassicPress Petitions
This is a read-only archive. Post or comment on the live version of this page on our forums.

Handling ajax other than via admin-ajax.php

September 10, 2018 · 02:32 · ibes

There should be a way to handle ajax requests without the downsides of admin-ajax.php

I guess this file has not been intended to how it is used.

There should be a way to do effective ajax requests without loading all plugins, without require the wp-admin folder to stay in place (can also not just be protected by basic auth because of that dependency) etc.

Having a standadized way to handle ajax calls is a good thing and should be possible.

+5 more
Request: Modify feature
Daniele Scasciafratte

Probably improve the ajax system with options like passing what plugins are required to be executed etc can be an interesting solution.


You can currently achieve this by using the REST API (which avoids having to load wp-admin) and then using the Rest Manager plugin to choose which plugins should load for each endpoint. I use this method a lot and it works very well, but it does mean choosing manually which plugins to run.

If that choice could be automated, that would be great, but I don't really see how that is feasible. How could it possibly cater for every plugin?

Daniele Scasciafratte

We use the add_action method but if we will create a new filter to explain what run as example can be a workaround to keep support and add that new feature.

Fabian Wolf

I also see quite a few plugins rely on their "own" implementations, that is, bootstrap WP and then emulate the AJAX behaviour. Sometimes this is even unavoidable, because of some server issue, and you have to rely on your own "version" of WP AJAX.