Currently there are 29,023 plugins with 585,736,872 downloads & both the numbers are increasing everyday. So if you want a new functionality on your site, you will find number of plugins making that available for you.
WordPress plugins can create problem of plenty at times for WordPress site owners, specially the new WordPress users can get confused easily with number of options they get, it becomes really difficult to suppress your greed for some plugins.
But, do you know each plugin you add to your site affects the loading speed of your site to an extent, so try to be limited in terms of number of plugin on your site.
Many plugins ads their own stylesheet on your site, sometimes the increased load time because of these stylesheet could be significant which may slowdown your site altogether.
So, what is the solution?
Solution is to disable all additional stylesheets that plugins add on each page load. For all the new WordPress users the easiest way to achieve that is by using a plugin called WP Asset Manager a new plugin that will deactivate individual or all WP plugin styles and scripts per page to decrease load time.
How to setup WP Asset Manager WordPress Plugin
- Add folder to wp-content/plugins/ directory
- Login to wp-admin
- Go to plugins
- Activate plugin
- Put the following code into your themes header and footer.
- All plugin scripts and stylesheets will be disabled by default
- When editing a page, a new widget will appear below the MCE editor where you can enable / disable scripts.
Add the following code to your themes header and footer
header.php
`<?php
wp_reset_query();
global $post;
$styles_query = get_post_meta( $post->ID, '_active_styles', true );
$styles_array = unserialize($styles_query);
?>
<?php if (!empty($styles_array[0])) { foreach($styles_array as $style): ?>
<link rel="stylesheet" href="<?php echo $style; ?>">
<?php endforeach; } ?>`
footer.php
`<?php
wp_reset_query();
global $post;
$scripts_query = get_post_meta( $post->ID, '_active_scripts', true );
$scripts_array = unserialize($scripts_query);
?>
<?php if (!empty($scripts_array[0])) { foreach($scripts_array as $script): ?>
<script src="<?php echo $script; ?>"></script>
<?php endforeach; } ?>`
oh yeah! I`ll definitely look into this. Too many css and js enqueues are in most cases the main reason for a low google pagespeed score.
I check the plugin for the script handle and deregister the file manually so this plugin could save that step.
I`m just wondering if there is a reason that the plugin does not add the headerfooter codes itself?
It doesn’t add the header and footer codes itself because devs sometimes add js into the websites header so ive just giving a more flexible option. Though I might scrap that and force the JS to always output in the footer. Let me know how u get on
Thanks for the reply John