WordPress.org

Ready to get started?Download WordPress

Forums

How to dequeue styles in parent theme (1 post)

  1. sccr410
    Member
    Posted 1 year ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.