1

is there a way to load a plugin, after the whole page is rendered and fully loaded?

I have horrible pagespeed according to Google and webpagetools. One plugin (provenexpert), is loading several fonts and loads of JS.

Is there a way to use this plugin but prevent the bad loading times?

Thank you!

1

I'd reach out directly to that plugin developer to relate your concerns, and if they're not responsive consider a different plugin. But in the meantime, you can use wp_dequeue_script() and wp_dequeue_style() and their counterparts wp_enqueue_script/style to remove the stuff that's slowing down your site.

This answer has more detail on how to move scripts from the header to the footer: https://wordpress.stackexchange.com/a/212274/16

To find the IDs of the styles/scripts you're trying to move using those functions, View Source and look at the ID, for instance:

  1. <link rel='stylesheet' id='eo-leaflet.js-css' href='https://.... or
  2. <link rel='stylesheet' id='mystyles-css-css' href='https://... or
  3. <script type='text/javascript' id='coblocks-lightbox-js' src='https://... or
  4. <script type='text/javascript' id='pluginname-script-js' src='https://...

The trick is, WordPress automatically appends -css to stylesheet IDs and -js to script IDs, so you need to IGNORE the trailing -css and -js in the examples above when figuring out their IDs. The actual IDs you'd use for wp_dequeue_script/style etc would be:

  1. eo-leaflet.js
  2. mystyles-css
  3. coblocks-lightbox
  4. pluginname-script

If you still run into issues removing them, the next thing to check is the hook being used (the add_action part in the answer referenced above). Plugins/themes use a variety of these to insert their scripts/styles so you have to adjust accordingly when trying to remove them. This answer uses different add_action calls that might work better than the ones in the previous answer:

https://wordpress.stackexchange.com/a/202895/16

(You put all this in the functions.php file of your theme.)

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.