Skip Navigation

[Resolved] Optimize front end css

This thread is resolved. Here is a description of the problem and solution.

Problem:
Try to optimize my site loading and find by all site speed tools that there are some toolset css files which critically impact site optimization:

/wp-content/plugins/layouts/vendor/toolset/toolset-common/res/css/toolset-notifications.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css

Is there any chance to remove these css or optimize it on frontend?

Solution:
Please add this code in your theme’s or child theme’s functions.php file to dequeue (remove) it on the frontend:

add_action('wp_enqueue_scripts', function() {
  wp_dequeue_style('toolset-notifications');
  wp_dequeue_style('onthego-buttons');
  wp_dequeue_style('onthegosystems-icons');
  wp_dequeue_style('onthego-colors');
  wp_dequeue_style('onthego-styles-helper');
  wp_dequeue_style('onthego-admin-styles');
   
}, 20);

Relevant Documentation:
https://codex.wordpress.org/Function_Reference/wp_dequeue_style
http://inspirationalpixels.com/tutorials/remove-plugin-scripts-wordpress

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by kirillS-3 7 years ago.

Assisted by: Noman.

Author
Posts
#578087

Hi!

I try to optimize my site loading and find by all site speed tools that there are some toolset css files which critically impact site optiomization:

/wp-content/plugins/layouts/vendor/toolset/toolset-common/res/css/toolset-notifications.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthego-styles/onthego-colors.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthego-styles/onthego-styles-helper.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthego-styles/onthego-admin-styles.css
/wp-content/plugins/cred-frontend-editor/vendor/toolset/onthego-resources/onthego-styles/onthego-buttons.css

I see here some issues:
1. Some of these css files not used on site frontend, so why it should be load there?
2. I use some css minification/optimization methods as CloudFlare and WP Rocket... but the wat these css files loaded via @import is not good for css minification services.

So, is there any chance to remove these css or optimize it on frontend?

#578095

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Kirill,

Thank you for contacting Toolset support. This file contains our custom icons and stylings for Views like in backend and may contain some frontend icons for Maps (like pin icon etc).

You should be able to dequeue it on frontend using wp_dequeue_style using some custom code:
https://codex.wordpress.org/Function_Reference/wp_dequeue_style
hidden link

Please add this code in your theme’s or child theme’s functions.php file to dequeue it on the frontend:

add_action('wp_enqueue_scripts', function() {
  wp_dequeue_style('toolset-notifications');
  wp_dequeue_style('onthego-buttons');
  wp_dequeue_style('onthegosystems-icons');
  wp_dequeue_style('onthego-colors');
  wp_dequeue_style('onthego-styles-helper');
  wp_dequeue_style('onthego-admin-styles');
  
}, 20);

Thank you

#578184

Thanks, it works