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
1 Answer
Reset to default 0You 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().