Remove unnessary scripts
Author | Posts |
---|---|
May 30, 2013 at 5:57 pm 4358 | |
madegood | Hi, Please could you tell me how to prevent wpufe from loading external scripts when not necessary. For example, it is loading the following files on every page, when I only want them to load on a page with a form on; /wp-content/plugins/wp-user-frontend-pro/css/jquery-ui-1.9.1.custom.css?ver=3.5.1 /wp-content/plugins/wp-user-frontend-pro/js/jquery-ui-timepicker-addon.js?ver=3.5.1 /wp-content/plugins/wp-user-frontend-pro/js/frontend-form.js?ver=3.5.1 Thanks in advance Will |
May 30, 2013 at 6:17 pm 4359 | |
Tareq Hasan | When it’s loaded once, the browser will cache the scripts and will serve the scripts from cache for later requests. So will it make difference to exclude them? |
May 30, 2013 at 6:23 pm 4361 | |
madegood | Hmmm, well it does make a difference because a majority of my users won’t be using the plugin. Those three scripts alone come to over 100kb, which is about 20% of the size of my homepage. It all adds up at, and ultimately is a significant load when speed is important. Cheers |
May 30, 2013 at 6:30 pm 4362 | |
Tareq Hasan | check the if ( $post && (is_page( 133 ) || is_page( 34 )) ) { } Now move the scripts into this |
May 30, 2013 at 6:34 pm 4364 | |
madegood | Okay, the function on around line 161, right? And I’m assuming I’ll have to redo this every time I upgrade? Thanks for taking the time to look into this. |
May 30, 2013 at 6:39 pm 4366 | |
Tareq Hasan | Yes, 161 and you’ll have to do it everytime. |
May 30, 2013 at 6:40 pm 4368 | |
madegood | Nice one |