admin管理员组文章数量:1293670
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!
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!
Share Improve this question asked Apr 30, 2021 at 12:16 patrickgerardpatrickgerard 1112 bronze badges1 Answer
Reset to default 1I'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/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:
<link rel='stylesheet' id='eo-leaflet.js-css' href='https://....
or<link rel='stylesheet' id='mystyles-css-css' href='https://...
or<script type='text/javascript' id='coblocks-lightbox-js' src='https://...
or<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:
- eo-leaflet.js
- mystyles-css
- coblocks-lightbox
- 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/a/202895/16
(You put all this in the functions.php file of your theme.)
本文标签: How to load plugin after page is loadedpagespeed issues
版权声明:本文标题:How to load plugin after page is loaded - pagespeed issues 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741584235a2386749.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论