Skip to content

Instantly share code, notes, and snippets.

@natebot
Created October 31, 2014 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natebot/0b13251e44f7513b8505 to your computer and use it in GitHub Desktop.
Save natebot/0b13251e44f7513b8505 to your computer and use it in GitHub Desktop.
SailThru plugin hack to prevent unnecessary loading of scrips and styles.
<?php
/**
* Force the unregistering of SailThru widgets and dequeue unused scripts and styles.
* If you don't have the SailThru widget on your site the plugin should not load the widget's styes and scripts.
* @todo the SailThru plugin should be improved to only enqueue when widgets are active
* I've submitted the fix patch: https://github.com/sailthru/sailthru-wordpress-plugin/pull/21
* Only use this hack if you never intend to use the SailThru widget, as it will break the Sailthru widget if you choose to activate it.
*/
add_action( 'widgets_init', function(){
unregister_widget( 'Sailthru_Subscribe_Widget' );
unregister_widget( 'Sailthru_Scout_Widget' );
});
add_action( 'wp_enqueue_scripts', function(){
wp_dequeue_script( 'sailthru-subscribe-script' );
wp_dequeue_style( 'sailthru-subscribe-widget-styles' );
}, 11);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment