WP Manifestindependent plugin directory
manifest / performance / wp-deferred-loading

Deferred loading

Defer loading of stylesheets and JavaScript files.

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/wp-digital/wp-deferred-loading/archive/refs/heads/master.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Deferred loading

Description

WordPress plugin for deferred loading of JavaScript and CSS files.

Install

Clone this repo to wp-content/plugins/:

cd wp-content/plugins/
git clone git@github.com:innocode-digital/wp-deferred-loading.git

Activate Deferred loading from Plugins page or WP-CLI: wp plugin activate wp-deferred-loading.

Also you could install it as a Must Use Plugin.

Usage

To defer JavaScript files, add to functions.php of theme:

add_filter( 'deferred_loading_scripts', function () {
    return [
        // List of enqueued scripts.
    ];
} );

or

add_filter( 'deferred_loading_scripts', function () {
    return '*'; // All enqueued scripts.
} );

To defer CSS files, add to functions.php of theme:

add_filter( 'deferred_loading_styles', function () {
    return [
        // List of enqueued styles.
    ];
} );