asp/assets/load/js

Hook to control the loading of plugin javascript files programmatically for the site front-end.

apply_filters('asp/assets/load/js', $load);

Parameters

  • $load (bool) - when true, the JS files are loaded

Examples

// Stops loading Ajax Search Pro javascript files everywhere except the archives
add_filter( 'asp/assets/load/js', function ( $load ) {
    if ( is_archive() ) {
        return true;
    }
    return false;
}, 10, 1 );

// Stops loading Ajax Search Pro javascript files everywhere except singular pages
add_filter( 'asp/assets/load/js', function ( $load ) {
    if ( is_singular() ) {
        return true;
    }
    return false;
}, 10, 1 );

Last updated