Speed up AJAX Requests (Advanced)

Sometimes getting content for DataTables can be too slow.

The DataTables Extension implements WordPress best practices by sending all data requests through the admin-ajax.php endpoint. Getting the data this way means that WordPress needs to load all of the WordPress plugins and files before processing the request and returning the value. This can slow up DataTables response times.

To improve the extension speed, we've added the ability to "bootstrap" WordPress and load only the files that are needed to run Gravity Forms, GravityView, GravityView DataTables Extension, and other GravityView Extensions. This improves request times by over half a second.

So here's a shortcut, to be used carefully

The requests will still be validated, and although we are not aware of any security risks, there may be security implications.  Use at your own risk, and not for sensitive data.

If you want to enable Direct AJAX, add the code below  to your functions.php file:

Note: Actions and filters that modify field output will not be triggered when using Direct AJAX.


How it works

By enabling Direct AJAX, the DataTables script will load the following files:

wp-load.php
wp-includes/locale.php
wp-includes/class-wp-walker.php
wp-includes/plugin.php
wp-includes/load.php
wp-includes/l10n.php
wp-includes/general-template.php
wp-includes/link-template.php
wp-includes/formatting.php
wp-includes/kses.php
wp-includes/pluggable.php
wp-includes/capabilities.php
wp-includes/user.php
wp-includes/meta.php
wp-includes/session.php
wp-includes/shortcodes.php
wp-includes/theme.php
wp-includes/template.php
wp-includes/widgets.php
wp-includes/rewrite.php
wp-includes/query.php

These files are the bare minimum needed to run Gravity Forms and GravityView. Once those files have been loaded, the DataTables Extension then looks for Gravity Forms, GravityView, and other GravityView Extensions in the plugins folder (defined by WP_PLUGIN_DIR) and attempts to load them by calling their loading functions.

The requests will still be validated by nonce, and although we are not aware of any security risks, there may be security implications. Use at your own risk, and not for sensitive data.