• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Can't disable css files.

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Can't disable css files.

This topic is: not resolved
  • This topic has 9 replies, 3 voices, and was last updated 10 years, 7 months ago by hugh71158.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • December 18, 2015 at 1:08 am #174180
    hugh71158
    Member

    Hi,

    I have created a custom css stylesheet, and entering the URL in a browser shows me it is working ok. However, I can't get the files it is supposed to replace to stop loading. Can anyone see where I am going amiss? The code I am using in the functions.php file in my Dynamik theme is:

    // Disable CSS Site-Wide Using CSS Script Handle
    
    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
    
    function my_deregister_styles() {
    wp_deregister_style( 'dynamik_minified_stylesheet' );
    wp_deregister_style( 'font-awesome' );
    wp_deregister_style( 'fl-builder-layout-6' );
    wp_deregister_style( 'gd-full-width' );
    wp_deregister_style( 'gforms_reset_css' );
    wp_deregister_style( 'gforms_formsmain_css' );
    wp_deregister_style( 'gforms_ready_class_css' );
    wp_deregister_style( 'gforms_browsers_css' );
    wp_deregister_style( 'gforms_datepicker_css' );
    }
    

    Any help is appreciated.

    Thanks!

    Hugh


    Venture Photography

    https://ventureweddingphotography.com
    December 18, 2015 at 10:09 am #174216
    jeseph
    Member

    Try replacing 'wp_print_styles' with 'wp_enqueue_scripts'

    wp_print_styles is a depreciated hook https://make.wordpress.org/core/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/

    December 18, 2015 at 10:22 am #174218
    hugh71158
    Member

    Hi, thanks for the reply. I changed it to the code below - still the css files are all loading. 🙁

    Hugh

    // Disable CSS Site-Wide Using CSS Script Handle
    
    add_action( 'wp_enqueue_scripts', 'my_deregister_styles', 100 );
    
    function my_deregister_styles() {
    wp_deregister_style( 'dynamik_minified_stylesheet' );
    wp_deregister_style( 'font-awesome' );
    wp_deregister_style( 'fl-builder-layout-6' );
    wp_deregister_style( 'gd-full-width' );
    wp_deregister_style( 'gforms_reset_css' );
    wp_deregister_style( 'gforms_formsmain_css' );
    wp_deregister_style( 'gforms_ready_class_css' );
    wp_deregister_style( 'gforms_browsers_css' );
    wp_deregister_style( 'gforms_datepicker_css' );
    }

    Venture Photography

    December 18, 2015 at 10:23 am #174219
    jeseph
    Member

    Sorry, moving too fast, also try changing wp_deregister_style to wp_dequeue_style

    December 18, 2015 at 11:07 am #174229
    hugh71158
    Member

    Yeah, it steadfastly refuses to work. Sorry for being a pain. I appreciate the effort. I tried:

    // Disable CSS Site-Wide Using CSS Script Handle
    
    add_action( 'wp_enqueue_scripts', 'my_dequeue_styles', 100 );
    
    function my_deregister_styles() {
    wp_dequeue_style( 'dynamik_minified_stylesheet' );
    wp_dequeue_style( 'font-awesome' );
    wp_dequeue_style( 'fl-builder-layout-6' );
    wp_dequeue_style( 'gd-full-width' );
    wp_dequeue_style( 'gforms_reset_css' );
    wp_dequeue_style( 'gforms_formsmain_css' );
    wp_dequeue_style( 'gforms_ready_class_css' );
    wp_dequeue_style( 'gforms_browsers_css' );
    wp_dequeue_style( 'gforms_datepicker_css' );
    }

    Venture Photography

    December 18, 2015 at 11:10 am #174230
    jeseph
    Member

    In this latest version you're adding a function called my_dequeue_styles but the function is named my_deregister_styles

    make sure those match 🙂

    December 18, 2015 at 11:17 am #174231
    hugh71158
    Member

    Ah!! I think I have it now, but still all the stylesheets are loading. ???

    // Disable CSS Site-Wide Using CSS Script Handle
    
    add_action( 'wp_enqueue_scripts', 'my_dequeue_styles', 100 );
    
    function my_dequeue_styles() {
    wp_dequeue_style( 'dynamik_minified_stylesheet' );
    wp_dequeue_style( 'font-awesome' );
    wp_dequeue_style( 'fl-builder-layout-6' );
    wp_dequeue_style( 'gd-full-width' );
    wp_dequeue_style( 'gforms_reset_css' );
    wp_dequeue_style( 'gforms_formsmain_css' );
    wp_dequeue_style( 'gforms_ready_class_css' );
    wp_dequeue_style( 'gforms_browsers_css' );
    wp_dequeue_style( 'gforms_datepicker_css' );
    }
    

    Venture Photography

    December 21, 2015 at 11:24 pm #174534
    coralseait
    Member

    Try both wp_dequeue and wp_dergeister with a priority on your action of very high, say 99999

    so something like:

    // Disable CSS Site-Wide Using CSS Script Handle
    
    add_action( 'wp_enqueue_scripts', 'my_dequeue_styles', 99999);
    function my_dequeue_styles() {
    wp_dequeue_style( 'dynamik_minified_stylesheet');
    wp_deregister_style( 'dynamik_minified_stylesheet');
    }

    For brevity I just listed a single example of dequeue and deregister in the function, you'd add all of them in it so each script is dequeued and deregistered.


    Coral Sea IT

    December 21, 2015 at 11:27 pm #174535
    coralseait
    Member

    Oh yes, make sure there's no caching occuring, you may have a server cache that needs flushing as well, not sure


    Coral Sea IT

    December 22, 2015 at 7:59 am #174548
    hugh71158
    Member

    Thanks, I'll try that.

    I was getting nowhere with this, and I had been stuck on a Pagespeed score of 71/100, but installing a plugin called Autoptomize solved the issue for me. I managed to get to 100/100.

    So, it's now a question of which way to head with this.

    Thanks!!!


    Venture Photography

  • Author
    Posts
Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble