Faster AJax Calls In WordPress By Using The AjaxFlow Plugin

Faster AJax Calls In WordPress By Using The AjaxFlow Plugin

Is it possible to achieve faster Ajax Calls in WordPress? You bet it is possible and you can start doing it right now with very little edits to the code you already have in place. We are going to be using a little plugin called AjaxFlow to speed it up, but first let’s go over the regular, slow way of doing Ajax Calls in WordPress.

Meet Ajaxflow

By installing this plugin in your Website, your Ajax calls will be so fast you’ll think it’s sorcery, but it is not, I think it’s not. All kidding aside, the plugin basically tells WordPress to load the bare minimum instead of loading the whole WordPress environment, thus speeding everything up and resulting in much faster Ajax calls. I’m talking calls that would normally would take 3-5 seconds on a good server down to 100-300 milliseconds.

How To Use Use AjaxFlow

Using AjaxFlow is super easy, and if you are already using regular Ajax calls within WordPress using wp_ajax_nopriv_$action and wp_ajax_$action, converting to AjaxFlow can be done in minutes.

What Are The Differences?

  • Ajax calls need to be made to /ajaxflow/$action, meaning that /wp-admin/admin-ajax.php is no longer used.
  • Passing the action parameter in your Ajax request is no longer necessary since we include the action in the call endpoint as explained above
  • ajaxflow_nopriv_$action and ajaxflow_$action must be used in your PHP code instead of using wp_ajax_nopriv_$action and wp_ajax_$action

AjaxFlow Example

If for some reason you get an error message other than zero saying your call $action doesn’t exists, then it means you have forgotten to add the Ajax handler in the back-end or you didn’t add it properly since it can’t find it.

That’s it, give it a try and watch your Ajax calls fly.

Published by

Yojance Rabelo

To me, WordPress is a system to which versatility and power come naturally. Over the last thirteen years of my life, I have seen WordPress evolve from a simple blogging platform into the leading CMS that powers more than 27% of the Internet. My experience is broad, ranging all the way from writing WordPress plugins to creating WordPress themes based on PSD files. I am a master of developing and deploying membership sites powered by WooCommerce, WooCommerce Memberships, and WooCommerce Subscriptions.