Jetpack CDN controls and customization - coder at laptop

Jetpack Hooks: Control Jetpack CDN

Note: We wrote this article with advanced users in mind; you’ll need some coding knowledge to accomplish these tasks. As always, enable Jetpack Backup so you can easily revert your site in case of a mistake. Hooks are a way for one piece of code to interact with or modify another piece of code. They make up the foundation for how Jetpack interacts with WordPress Core.

If you have questions about how to use these yourself, ask the Jetpack community in the forums. If you’d like to hire help, reach out to a service like Codeable

Continue reading → Jetpack Hooks: Control Jetpack CDN

Posted in Code snippets, Performance | Tagged , , , , , | 10 Comments

How to disable the auto-activation of a Jetpack module

In Jetpack 2.6, we will introduce a new filter, jetpack_get_default_modules. It will allow you to stop the auto-activation of a specific Jetpack module.

Here is an example with the Widget Visibility module:

// To disable the auto-activation of Jetpack's Widget Visibility module:
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_widget_visibility_autoactivate' );
function disable_jetpack_widget_visibility_autoactivate( $modules ) {
	return array_diff( $modules, array( 'widget-visibility' ) );
}

// Or, to disable the functionality in your own plugin if the user activates it in Jetpack:
if ( ! class_exists( 'Jetpack' ) || ! Jetpack::is_module_active( 'widget-visibility' ) ) {
	// It's not there, do as you like!
}

Reference.

If you wanted all Jetpack modules to be deactivated by default, you could use the following code:

add_filter( 'jetpack_get_default_modules', '__return_empty_array' );
Posted in Code snippets, Tips & Tricks | Tagged , , , , | Comments Off on How to disable the auto-activation of a Jetpack module
  • Enter your email address to follow this blog and receive news and updates from Jetpack!

    Join 112.3K other subscribers
  • Browse by Topic