I'm currently building a pretty straightforward plugin, but it relies quite extensively on AJAX requests. I'm using the standard admin-ajax
endpoint for the requests, but I find that it seems to be massively inconsistent, sometimes the request (for the same data) will take a few hundred milliseconds and then sometimes take a couple of seconds.
I am aware that there is heartbeat
issue that can be a problem when using admin-ajax
which when modified can help improve request speeds when using the endpoint.
I suppose I could point the requests directly to a PHP file and use that as an endpoint, but is there anyway I can create an endpoint that uses Wordpress's routing?
So my question is; Does Wordpress have support for custom ajax endpoints / url parameters that will fire function calls etc..?
I'm also aware that I could use the REST API route callbacks, but I'd like this plugin to be dependency free where possible so it will be supported on version of Wordpress that don't include the REST API.
Thanks for any help!