Skip to content

Instantly share code, notes, and snippets.

@psflannery
Created October 16, 2013 09:21
Show Gist options
  • Save psflannery/7005015 to your computer and use it in GitHub Desktop.
Save psflannery/7005015 to your computer and use it in GitHub Desktop.
http://jetpack.me/2013/10/07/do-not-automatically-activate-the-widget-visibility-module/ This code can apply to any other module, and can be used as a replacement of the Manual Control plugin for example.
// To disable the auto-activation of Jetpack's Widget Visibility module:
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_widget_visibility_autoactivate' );
function disable_jetpack_widget_visibility_autoactivate( $modules ) {
return array_diff( $modules, array( 'widget-visibility' ) );
}
// Or, to disable the functionality in your own plugin if the user activates it in Jetpack:
if ( ! class_exists( 'Jetpack' ) || ! Jetpack::is_module_active( 'widget-visibility' ) ) {
// It's not there, do as you like!
}
// If you wanted all Jetpack modules to be deactivated by default, you could use the following code:
add_filter( 'jetpack_get_default_modules', '__return_empty_array' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment