Title: Please optimize the plugins script loading
Last modified: February 26, 2023

---

# Please optimize the plugins script loading

 *  Resolved [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/)
 * There is no need to load all the heavy scripts on every WordPress page. You can
   call `wp_enqueue_script `at any time b4 the footer scripts are printed. I guess
   there is no need to load the scripts in the `<head>`.
 * To do this, remove this line from the `WPSC_Frontend` class:
 *     ```wp-block-code
       add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
       ```
   
 * And then you load the scripts only when the shortcodes are actually used on pages.
   You can call WPSC_Frontend::load_scripts() inside all the `layout` methods for
   all the shortcodes where the scripts are needed.
 *     ```wp-block-code
       	final class WPSC_Shortcode_One {
   
       		// ...
   
       		/**
       		 * "supportcandy" shortcode layout
       		 *
       		 * @param array $attrs - Shortcode attributes.
       		 * @return string
       		 */
       		public static function layout( $attrs ) {
       			\WPSC_Frontend::load_scripts();
       ```
   
 * I would appreciate if you do this and test it, it seems to work fine for me. 
   That way, people sites are not polluted with all these scripts that are only 
   needed for the support page(s). Especially because these are quite a lot and 
   they are typically backend scripts.
 * Great plugin btw, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [miliighe](https://wordpress.org/support/users/miliighe/)
 * (@miliighe)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/#post-16508401)
 * Hello [@nico23](https://wordpress.org/support/users/nico23/),
 * Thanks for contacting us. Hope you are doing well.
 * Thank you for valuable suggestion. I will forward it to our development team.
 * Meanwhile, we have address this issue by another way, you can select the pages
   on which you want to load SupportCandy Script.
 * Please go to **Dashboard > Support > Settings > Miscellenious > Advanced > Load
   Script > Custom > Select the Pages > Submit.**
 * I hope this will resolve the issue, please feel free to get back to us if you
   face any other issues.
 * Thank you.
 *  Thread Starter [Nico](https://wordpress.org/support/users/nico23/)
 * (@nico23)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/#post-16512132)
 * I do not understand what you are doing and saying. I do not have these options
   you speak off. Do you mean they will be implemented in the next version?
 * And why would you do it that way? I showed you how to do it without any options
   automatically. Having it as an option that you manually have to select the pages
   where the script loads makes no sense if you can just have the shortcodes automatically
   load them.
 *  [eros86](https://wordpress.org/support/users/eros86/)
 * (@eros86)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/#post-16517124)
 * [@nico23](https://wordpress.org/support/users/nico23/) and [@miliighe](https://wordpress.org/support/users/miliighe/)
   I can see this option in other place **Dashboard > Support > Settings >** **General
   Settings > Page settings and at bottom of page > Load scripts**
   Changing this
   option increase speed of my page for mobile from 59 to 82 at mobile device
 *  [miliighe](https://wordpress.org/support/users/miliighe/)
 * (@miliighe)
 * [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/#post-16517577)
 * Hello [@nico23](https://wordpress.org/support/users/nico23/),
 * The above reply from [@eros86](https://wordpress.org/support/users/eros86/) is
   correct. There was a typing mistake on my end. You can find the settings to control
   the loading of script on selected pages from **Dashboard > Support > Settings
   >** **General Settings > Page settings > Load scripts**.
 * Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Please optimize the plugins script loading’ is closed to new replies.

 * ![](https://ps.w.org/supportcandy/assets/icon.svg?rev=2763565)
 * [SupportCandy - Helpdesk & Customer Support Ticket System](https://wordpress.org/plugins/supportcandy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/supportcandy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/supportcandy/)
 * [Active Topics](https://wordpress.org/support/plugin/supportcandy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/supportcandy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/supportcandy/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [miliighe](https://wordpress.org/support/users/miliighe/)
 * Last activity: [3 years, 2 months ago](https://wordpress.org/support/topic/please-optimize-the-plugins-script-loading/#post-16517577)
 * Status: resolved