add_action( 'widgets_init', 'jetpack_gallery_widget_init' );
* Jetpack Gallery widget init; the widget is conditionally registered.
function jetpack_gallery_widget_init() {
* Allow the Gallery Widget to be enabled even when Core supports the Media Gallery Widget
* @param bool false Whether to force-enable the gallery widget
! apply_filters( 'jetpack_force_enable_gallery_widget', false )
&& class_exists( 'WP_Widget_Media_Gallery' )
&& Jetpack_Options::get_option( 'gallery_widget_migration' )
if ( ! method_exists( 'Jetpack', 'is_module_active' ) || Jetpack::is_module_active( 'tiled-gallery' ) ) {
register_widget( 'Jetpack_Gallery_Widget' );