Filters the HTML script tag of an enqueued script.
Filtre la balise de script HTML d'un script mis en file d'attente.
$tag, $handle, $src
Sortie :
@param string $tag The `<script>` tag for the enqueued script. @param string $handle The script's registered handle. @param string $src The script's source URL.
add_filter('script_loader_tag', 'add_script_attributes', 10, 3);
function add_script_attributes($tag, $handle, $src) {
if ($handle === 'main-script') {
$tag = str_replace(' src=', ' defer src=', $tag);
}
return $tag;
}
Chargement des actualités...