最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Disabling drift plugin from homepage

programmeradmin3浏览0评论

So our client wants to use Drift the messaging pop up plugin but it is seriously hindering load speeds on the homepage. I can halve the load time by disabling it but they want to keep it through out the rest of the site, i have tried several plugin organiser plugins but none of them seem to register it, does any one know of any code snippet or know more about how drift works so i can just stop it from loading on a homepage?

So our client wants to use Drift the messaging pop up plugin but it is seriously hindering load speeds on the homepage. I can halve the load time by disabling it but they want to keep it through out the rest of the site, i have tried several plugin organiser plugins but none of them seem to register it, does any one know of any code snippet or know more about how drift works so i can just stop it from loading on a homepage?

Share Improve this question asked Feb 27, 2020 at 22:07 growthgungrowthgun 1 1
  • Have you contacted Drift plugin support? 3rd party plugin support is offtopic on this stack – Tom J Nowell Commented Feb 27, 2020 at 22:41
Add a comment  | 

1 Answer 1

Reset to default 0

You can see that the plugin embeds the Drift code by hooking wp_head:

// Add the Drift Javascript
add_action('wp_head', 'add_drift');

So all you need to do is

remove_action( 'wp_head', 'add_drift' );

when you're on the homepage, e.g. in an if (is_home()) or if (is_front_page()) block (they're more or less equivalent here) in your theme, which will be loaded after the plugins. Or you could even put this at the top of your home page template before you call wp_head().

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论