0

I'm writing style codes for a WordPress theme. But the theme reads the style codes from the style.min.css file. I just want it to read from the style.css file. How can I disable it from reading from this compressed css file?

1
  • 1
    What style.min.css file? Is it coming from WordPress or a theme? If it's from WordPress you're probably referring to the block styles. These are required for content created with the block editor to appear correctly on the front end. If you stop it from loading you're just going to need to rewrite it all anyway. Feb 22 at 7:27

2 Answers 2

0

you can be used enqueueing your own CSS file and deregister the default stylesheet using Wp default hook

Replace default-theme-style with to register name mentioned in the minified CSS style link.

Add code in functions.php file

Deregister for style.min.css

function deregister_default_stylesheet() {
    // Deregister the default stylesheet
    wp_deregister_style( 'default-theme-style' );
}
add_action( 'wp_enqueue_scripts', 'deregister_default_stylesheet', 20 );

// Enqueue your own stylesheet `style.css`

function theme_enqueue_styles() {
    // Enqueue your own stylesheet
    wp_enqueue_style( 'my-css-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
1
  • The compressed css file is inside a plugin. Does this require making any further changes?
    – A. Muller
    Feb 22 at 13:18
-1

You can enqueue your stylesheet this is how: https://developer.wordpress.org/reference/functions/wp_enqueue_style/

You can dequeue the existing stylesheet this is how: https://developer.wordpress.org/reference/functions/wp_dequeue_style/

2
  • Not working. Can you elaborate a little more?
    – A. Muller
    Feb 22 at 5:40
  • Did you dequeue the existing stylesheet? Feb 22 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.