• Resolved kingrobb

    (@kingrobb)


    Hello – I am developing a site on a “Site Ground” server. The new WP install came with SG Optimizer plugin installed. Whether this plugin is active or inactive my development CSS is still being cached and it is making my css development almost impossible to do. So I see that there is a way to exclude a css file from being cached by adding the following to my functions.php file …

    
     add_filter( 'sgo_css_combine_exclude', 'css_combine_exclude' );
    function css_combine_exclude( $exclude_list ) {
        // Add the style handle to exclude list.
        $exclude_list[] = 'style-handle';
    
        return $exclude_list;
    }
    
    add_filter( 'sgo_css_minify_exclude', 'css_minify_exclude' );
    function css_minify_exclude( $exclude_list ) {
        // Add the style handle to exclude list.
        $exclude_list[] = 'style-handle';
    
        return $exclude_list;
    }
    

    But what is a style-handle? Is it the ID of the style LESS “-css”?

    Example for this style:

    <link rel='stylesheet' id='style-css' href='https://myurl/wp-content/themes/mytheme/style.css?ver=8.2.1' type='text/css' media='all' />

    Would the following work…

    $exclude_list[] = 'style';

    And BTW I have tried the above and with using

    $exclude_list[] = 'style-css';

    … and neither has worked.

    So does Site Ground have some other kind of caching going on that you might know of?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Hristo Pandjarov

    (@hristo-sg)

    SiteGround Representative

    We have added an interface to handle excludes in the Frontend Optimizations tab so you don’t need to use the filter directly. It will show you all the loaded assets and you can simply click on the proper ones to exclude them ??

    @hristo-sg,

    Kindly define ‘style-handle’ for us. What is it? We need to use the filters provided because the front-end exclusion list does not include the files that we need to exclude.

    Another option is to update the plugin to allow the user to enter the file path (URL) of the file that needs to be excluded in the exclusions field. At this time, we’re limited to the pre-selected files given by the plugin.

    Thank you!

    HI,

    I have to agree with jetexpert, the UI drop-down does not list all we need to exclude ;-(

    so what is the handle?

    TY

    @marco1970,

    Following the above, I developed a procedure that will help you use some of their filters. Click here.

    I am hopeful SiteGround will soon develop a comprehensive article on how to use all of their filters.

    Meanwhile, recommend issuing a ticket to SG for detailed assistance.

    And not the least, we also use WP Rocket. You can use it with or without SG Optimizer. With WP Rocket, we never have to worry about the above. It also provides better tools to optimize your website. Give it a spin. You’ll like it.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘What is a “Style-Handle” is the style “ID”?’ is closed to new replies.