Modify which Jetpack Widgets to register.
Parameters
- $widgets_include
array An array of widgets to be registered.
Changelog
- Introduced in Jetpack 2.2.1
How to use this hook
Notes
In some cases, you might not want to see one of the modules in your dashboard, because you know you’ll never use it. That’s when thejetpack_widgets_to_include becomes handy. It allows you to edit the list of Jetpack widgets that will be available under Appearance > Widgets.
In the example below, we’ll remove the Google+ Badge widget from the list of available widgets:
// Search for the Google+ Badge Widget.
function jeherve_googleplus_badge_search( $widget ) {
return strpos( $widget, 'googleplus-badge' ) === false;
}
// Remove the Google+ Badge Widget.
function jeherve_remove_googleplus_widget( $widgets ) {
$widgets = array_filter( $widgets, 'jeherve_googleplus_badge_search' );
return $widgets;
}
add_filter( 'jetpack_widgets_to_include', 'jeherve_remove_googleplus_widget' );