• Resolved crazyrawkr

    (@crazyrawkr)


    Hello,

    I’m trying to use Code Snippets to deregister/dequeue stylesheets and scripts in order to load my own.

    However, I cannot get this function to work. Currently this is what I have set up:

    wp_dequeue_style( 'fontawesome' );
    wp_deregister_style( 'bootstrap' );

    I’ve looked up the handles in the plugins to ensure they’re correct. For example:

    wp_register_style('bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', array(), '3.3.5');

    But it isn’t working. Any help would be greatly appreciated!

    https://wordpress.org/plugins/code-snippets/

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    In order to requeue/deregister styles and scripts, you need to make sure you call the function after they have been registered. Usually, this can be achieved by hooking to the wp_enqueue_scripts action with a late priority, but this could change depending on your situation.

    add_action( 'wp_enqueue_scripts', function () {
        wp_dequeue_style( 'fontawesome' );
        wp_deregister_style( 'bootstrap' );
    }, 99 );
Viewing 1 replies (of 1 total)
  • The topic ‘Dequeueing/deregistering styles/scripts’ is closed to new replies.