WordPress.org

Ideas

Add a wp-ajax.php at the root of wordpress

  1. Tofandel
    Member

    Currently there is an admin-ajax.php that works great but has very poor performance because it sets is_admin() to return true and so some plugins or even the core start do do some heavy computation or config, although normal for the backend ajax; it would be great to have a non admin wp-ajax in WordPress 5.

    It would be located at the root of wordpress so the admin_hooks won't have to load/fire, the wp_query won't have to process and frontend plugins will be able to use this ajax instead of the old admin ajax, greatly reducing the loading time of the ajax-call and the load on the server, (+ there is already the nopriv hook so the separation will be easy to implement for plugins).

    There is currently workarounds such as just using parameters in the url (like wc-ajax for woocommerce) but those are not actually better because the wp_query still tries to do some work beforehand and some plugins do whatever they want with this and sometimes it's really really ugly...

    A core and unified way of doing that would be great for the community, better performances for users and happier developers spending less time implementing their ajax hooks.

    Posted: 3 weeks ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    0 Votes
  • Status

    This idea is under consideration