I have created a child theme from the openstrap theme and rather than use Openstraps bootstrap css file, I would like to use my own custom bootstrap css file (using bootstrap custom sass, which is all working fine).

Is there a way i can just prevent the parent themes bootstrap file from loading?

For testing, i have simply commented out the relevant parts in the parents function file, but obviously this is not the way to do it.

Im guessing there will be some sort of function to kind of unload it, that i can put in my functions file?

// Load Stylesheets. Load bootstrap css as per theme option selected
//$theme_style = of_get_option('theme_style');  
//if($theme_style=="default") {
//  wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.css' );
//  wp_enqueue_style( 'bootstrap-custom', get_template_directory_uri().'/css/custom.css' );
//} else {
//  wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/'.$theme_style.'/bootstrap.css' );
//  wp_enqueue_style( 'bootstrap-custom', get_template_directory_uri().'/css/'.$theme_style.'/custom.css' );
//wp_enqueue_style( 'font-awesome', get_template_directory_uri().'/css/font-awesome.min.css' ); 

1 Answer 1


You can use wp_deregister_style in your child theme. Like this.

function remove_unwanted_css() {
    wp_dequeue_style( 'bootstrap' );
    wp_deregister_style( 'bootstrap' );

    wp_dequeue_style( 'bootstrap-custom' );
    wp_deregister_style( 'bootstrap-custom' );
add_action( 'wp_enqueue_scripts', 'remove_unwanted_css', 20 );

Similarly you can deregister other unwanted css too. Just add wp_deregister_style in this function.

  • Great! I am glad I could help you with this. You can also remove JS files similarly.
    – Robert hue
    Sep 22, 2014 at 8:58

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.