admin_url( 'admin-ajax.php' ) ) ); register_setting( 'aj_options', 'aj_enabled' ); register_setting( 'aj_options', 'aj_method' ); register_setting( 'aj_options', 'aj_jquery' ); register_setting( 'aj_options', 'aj_exclusions' ); register_setting( 'aj_options', 'aj_upgrade_notice' ); register_setting( 'aj_options', 'autoptimize_enabled' ); register_setting( 'aj_options', 'aj_autoptimize_enabled' ); register_setting( 'aj_options', 'aj_autoptimize_method' ); $autoptimize_enabled = get_option( 'autoptimize_enabled' ); $aj_autoptimize_enabled = get_option( 'aj_autoptimize_enabled' ); } /** * async_javascript_menu() * * register admin menu * * @param n/a * @return n/a */ add_action( 'admin_notices', 'async_javascript_upgrade_notice' ); function async_javascript_upgrade_notice() { $aj_upgrade_notice = get_option( 'aj_upgrade_notice' ); $time = current_time( 'timestamp', 1 ); $exp = strtotime( '2017-01-01 00:00:01' ); if ( $aj_upgrade_notice != AJ_VERSION && $time < $exp ) { echo '

Christmas Sale! Get Async Javascript Pro for USD $10.00 (normally $35.00). Save $25.00!!! Offer ends 31st Dec 2016. Read more...

'; } } /** * async_javascript_menu() * * register admin menu * * @param n/a * @return n/a */ add_action( 'admin_menu', 'async_javascript_menu' ); function async_javascript_menu() { add_submenu_page( 'options-general.php', 'Async JavaScript Admin', 'Async JavaScript', 'manage_options', 'async-javascript', 'async_javascript_admin' ); } /** * async_javascript_admin() * * admin page * * @param n/a * @return n/a */ function async_javascript_admin() { // load settings from database ?>

Async JavaScript Settings

Enable Async JavaScript

When you enable Async JavaScript, when a script is loaded via the 'wp_enqueue_script' method, this plugin will add a 'async' or 'defer' attribute.
This action helps to eliminate render-blocking JavaScript in above-the-fold content. This can also help to increase your pagespeed which in turn will assist in improving your page ranking.
There are several ways an external script can be executed:
  • If async is present: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing)
  • If async is not present and defer is present: The script is executed when the page has finished parsing
  • If neither async or defer is present: The script is fetched and executed immediately, before the browser continues parsing the page
Note: There have been instances where enabling Async JavaScript has 'broken' the javascript delivery. Should this happen to you, I highly recommend installing the Autoptimize plugin which will combine your javascript, further enhancing pagespeed and eliminating this issue.
/>

Async JavaScript Method

Please select the method (async or defer) that you wish to enable:
Method /> Async /> Defer

jQuery Handler

If after enabling Async JavaScript for 'async' or 'defer' you receive jQuery errors in the console, try the following settings:
Method /> As Per Selected Method /> Defer /> Async /> Exclude

Script Exclusion

Please list any scripts which you would like excluded from being Async/Defered during page load. (comma seperated list eg: jquery.js,jquery-ui.js)
Exclusions

Async JavaScript For Plugins

Note: This will attempt to add the 'async' or 'defer' attribute to scripts loaded via a plugin (ie, not via 'wp_enqueue_script'). If you have a plugin that you would like added to this list please lodge a ticket at https://cloughit.com.au/support/

Autoptimize -

/>
Method /> Async /> Defer
No supported plugins installed or activated.

Need Some Help?

Lodge a support request at https://cloughit.com.au/support/

' tasks called via wp_enqueue_script using the 'script_loader_tag' filter * * @param string $tag The