should_load_block_assets_on_demand

FILTER wp-includes\script-loader.php (ligne 2707) github
Filters whether block styles should be loaded on demand. Returning false loads all block assets, regardless of whether they are rendered in a page or not. Returning true loads block assets only when they are rendered. The default value of the filter depends on the result of {@see wp_should_load_separate_core_block_assets()}, which controls whether Core block stylesheets should be loaded separately or via a combined 'wp-block-library' stylesheet.

Paramètres

Entrée :
$load_assets_on_demand
Sortie :
@param bool $load_assets_on_demand Whether to load block assets only when they are rendered.

Utilisation

// Modifier la valeur avec le filtre 'should_load_block_assets_on_demand'
add_filter('should_load_block_assets_on_demand', 'ma_fonction_filtre', 10, 1);

function ma_fonction_filtre($load_assets_on_demand) {
    // Modifier la valeur
    return $load_assets_on_demand;
}

Actualités

Chargement des actualités...