Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexdeborba/1dca47ee02bac23a20f8c2afe0409348 to your computer and use it in GitHub Desktop.
Save alexdeborba/1dca47ee02bac23a20f8c2afe0409348 to your computer and use it in GitHub Desktop.
Disable Jetpack modules except WooCommerce App
add_filter( 'jetpack_get_default_modules', 'disable_all_jetpack_modules_except_woocommerce' );
function disable_all_jetpack_modules_except_woocommerce( $modules ) {
// List of Jetpack modules needed for WooCommerce App.
$required_modules = array(
'json-api', // Required for the WooCommerce Mobile App.
// Add other modules as needed.
);
// Disable all modules except those in the list above.
foreach ( $modules as $i => $module ) {
if ( ! in_array( $module, $required_modules ) ) {
unset( $modules[ $i ] );
}
}
return $modules;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment