Skip to content

Commit

Permalink
Plugin tweaks: Add jetpack tweaks to always activate the Jetpack blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Jan 8, 2025
1 parent b19c079 commit 8751663
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions mu-plugins/plugin-tweaks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
require_once __DIR__ . '/stream.php';
require_once __DIR__ . '/incompatible-plugins.php';
require_once __DIR__ . '/gutenberg.php';
require_once __DIR__ . '/jetpack.php';
require_once __DIR__ . '/youtube-shortcode.php';
26 changes: 26 additions & 0 deletions mu-plugins/plugin-tweaks/jetpack.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace WordPressdotorg\MU_Plugins\Plugin_Tweaks\Jetpack;

defined( 'WPINC' ) || die();

/**
* Actions and filters.
*/
add_filter( 'jetpack_active_modules', __NAMESPACE__ . '\activate_jetpack_blocks' );

/**
* Ensure "blocks" module is active.
*
* The subscribe block is used in the footer template, so this must be active
* for all sites. The filter only fires if Jetpack itself is already active.
*
* @param string[] $modules Array of active Jetpack modules.
* @return string[]
*/
function activate_jetpack_blocks( $modules ) {
if ( ! in_array( 'blocks', $modules, true ) ) {
$modules[] = 'blocks';
}
return $modules;
}

0 comments on commit 8751663

Please sign in to comment.