• Resolved matredok

    (@matredok)


    Hello, I would like to deregister all styles used by hustle. Vanilla theme isn’t enough for me. I’ve tried but it doesn’t work for me:

    function dequeue_my_css() {
    	wp_deregister_style( 'hustle_icons' );
    	wp_deregister_style( 'hustle_global' );
    	wp_deregister_style( 'hustle_optin' );
    	wp_deregister_style( 'hustle_inline' );
    	wp_dequeue_style( 'hustle_icons' );
    	wp_dequeue_style( 'hustle_global' );
    	wp_dequeue_style( 'hustle_optin' );
    	wp_dequeue_style( 'hustle_inline' );
      }
      add_action('wp_enqueue_scripts','dequeue_my_css', 100);
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @matredok,

    Trust you are doing good.

    This is possible with the following filter,

    hustle_disable_front_styles

    The following code will disable style for all Hustle modules:

    add_filter( 'hustle_disable_front_styles', '__return_true' );

    Feel free to get back to us if you need any further assistance.

    Kind Regards,
    Nebu John

    Thread Starter matredok

    (@matredok)

    Thanks, it works ?? I have also found something like this:

    add_filter( 'style_loader_tag', function( $html, $handle, $href, $media ){
    
    $exclude_tags_for = array(
    'hustle_popup',
    'hustle_social',
    'hustle_inline',
    'hustle_float',
    'hustle_slidein',
    'hustle_icons',
    'hustle_global',
    'hustle_info',
    'sui_styles',
    'hstl-source-code-pro',
    'hstl-roboto',
    'hstl-opensans'
    );
    
    if ( in_array( $handle, $exclude_tags_for ) ) {
    return;
    }
    
    return $html;
    
    }, 20, 4 );
    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @matredok

    Thanks for response!

    The “style_loader_tag” is WordPress core filter and yes – it should work but I think the Hustle filter “hustle_disable_front_styles” is simpler solution here.

    It also has one important benefit: it will work the same even if there’ll be some new styles added or style handles (tags) will be modified in future releases, while the “core approach” will require you to modify your code in such cases.

    Best regards,
    Adam

    Thread Starter matredok

    (@matredok)

    Thanks! ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to deregister style’ is closed to new replies.