-
Notifications
You must be signed in to change notification settings - Fork 60
/
assets.php
48 lines (38 loc) · 1.11 KB
/
assets.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* De-registers WordPress default
*
* @link https://developer.wordpress.org/reference/functions/wp_dequeue_style/
*/
add_action(
'wp_enqueue_scripts',
function () {
wp_dequeue_style('wp-block-library'); // Wordpress block libaray styles
wp_dequeue_style('global-styles');// Wordpress global styles generated from theme.json
}
);
/**
* Remove oEmbed-specific JavaScript from the front-end and back-end.
*
* @link https://developer.wordpress.org/reference/functions/wp_oembed_add_host_js/
*/
remove_action( 'wp_head', 'wp_oembed_add_host_js' );
/**
* Remove wordpress version from scripts
*/
function remove_script_version ($src)
{
global $wp_version;
$parts = explode( "?ver=$wp_version", $src );
return $parts[0];
}
add_filter( 'script_loader_src', 'remove_script_version', 15, 1 );
add_filter( 'style_loader_src', 'remove_script_version', 15, 1 );
/**
* Remove type from style and script tags
*
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
*/
add_action('after_setup_theme', function () {
add_theme_support('html5', ['script', 'style']);
});