Remove / Disable default custom.css?ver=1.0.0
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Anybody can ask a question
Anybody can answer
The best answers are voted up and rise to the top
Asked
Viewed
17 times
On my front end on every single page, I have custom.css?ver=1.0.0
loading. But it’s not included anywhere in my custom-built theme.
At present, I am running WordPress v6.1.1
.
<link rel="stylesheet" id='custom-css' href="https://schoolarly.live/wp-content/themes/schoolarly/assets/css/custom.css?ver=1.0.0" type="text/css" media="all" />
Is this somehow loaded by default? If so, how can I prevent this?
1
Here’s how you could use the wp_dequeue_style
function in a WordPress hook to unenqueue the custom-css stylesheet:
function wpsx411806_unenqueue_custom_css() {
wp_dequeue_style( 'custom-css' );
}
add_action( 'wp_enqueue_scripts', 'wpsx411806_unenqueue_custom_css' );
In this example, the wpsx411806_unenqueue_custom_css
function uses the wp_dequeue_style
function to unenqueue the custom-css
stylesheet. The function is then registered as a callback for the wp_enqueue_scripts
hook.
add to your functions the style_loader_src
hook
function remove_query_string_from_static_files( $src ) {
if( strpos( $src, '?ver=" ) )
$src = remove_query_arg( "ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_query_string_from_static_files', 10, 2 );
2
lang-css
Leave an answer