Created
July 25, 2023 22:37
-
-
Save alexdeborba/1dca47ee02bac23a20f8c2afe0409348 to your computer and use it in GitHub Desktop.
Disable Jetpack modules except WooCommerce App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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