2

I have inherited a quite bloated wordpress website that runs really slow even on dedicated hosting. I am trying to optimize the speed of it. I have run the website through different websites that suggest what to optimize. One thing they all mention is to decrease the number of scripts used.

Through Chrome developer tools, if I look at load-scripts.php I see the function called twice. These are the load parameters:

c=0&load%5B%5D=thickbox,hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,postbox,tags-suggest,tag&load%5B%5D=s-box,word-count,post,editor-expand,shortcode,backbone,wp-util,wp-backbone,media-models,wp-plupload,mediaelement,wp-mediaelement&load%5B%5D=,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit,svg-painter,wp-auth-check,jquery-touch-punch,iris,w&load%5B%5D=p-color-picker,jquery-form,jquery-ui-tabs,media-upload,jquery-ui-accordion,wp-pointer,wplink,wp-embed&ver=4.7.2

My question is this:

  • Is this a normal amount of scripts to be executed in a wordpress website, or is this too much?
  • What would be the best strategy to disable the scripts? Will it be disabling the plugins and seeing if the website still functions?
2

This seems like far too much to me granted a lot of those files seem very necessary, what I tend to do it open each of those scripts and compile them into a single file and then unhook each of them as needed. A modern theme framework like sage helps a lot in doing this as its built into the build process.

Use remove_action() to unhook each script once you've found the hook they are registered with.

https://codex.wordpress.org/Function_Reference/remove_action

Unfortunately you are likely using a premade theme with a grip of dependencies that will bug out if you throw even one of those scripts out. And please keep in mind that the load order in which they are thrown onto the page can be important when compiling all of that into a single file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.