Skip to content

Commit

Permalink
Plugin tweaks: Ensure jetpack blocks are available and active.
Browse files Browse the repository at this point in the history
This enables the subscription widget across the network.

Follow up to 8751663
See WordPress/wporg-parent-2021#170
  • Loading branch information
ryelle committed Feb 18, 2025
1 parent 3a85962 commit 135b4df
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mu-plugins/plugin-tweaks/jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,23 @@
/**
* Actions and filters.
*/
add_filter( 'jetpack_get_available_modules', __NAMESPACE__ . '\available_jetpack_blocks', 100, 2 );
add_filter( 'jetpack_active_modules', __NAMESPACE__ . '\activate_jetpack_blocks' );

/**
* Add "blocks" module to available list, using `min_version` to ensure it's active.
*
* @param string[] $modules Array of modules (module name => version introduced).
* @param string $min_version Minimum version number required to use modules.
* @return string[]
*/
function available_jetpack_blocks( $modules, $min_version ) {
if ( ! isset( $modules['blocks'] ) ) {
$modules['blocks'] = $min_version;
}
return $modules;
}

/**
* Ensure "blocks" module is active.
*
Expand Down

0 comments on commit 135b4df

Please sign in to comment.