Support » Fixing WordPress » How to dequeue styles in parent theme

  • I am making a child theme based on a parent theme. The parent theme properly enqueues the styles with the following in the functions.php file:

    add_action('wp_enqueue_scripts', 'ProjectTheme_add_theme_styles');
    function ProjectTheme_add_theme_styles()  {
      	wp_register_style( 'bootstrap_style1', get_bloginfo('template_url').'/css/bootstrap_min.css', array(), '20120822', 'all' );
    	wp_enqueue_style( 'bootstrap_style1' );

    How do I prevent this CSS file from being loaded? I have tried the following in my child theme’s functions.php file:

    add_action('wp_enqueue_styles', 'mytheme_remove_css');
    function mytheme_remove_css() {
    	wp_dequeue_style( 'bootstrap_style1' );

    However, I have realized that the child theme’s functions.php file gets loaded before the parent’s – thus I am trying to dequeue styles that have not even been queued yet.

  • The topic ‘How to dequeue styles in parent theme’ is closed to new replies.