activating modules with a function

Hi guys,

I am managing a few sites now using the beaver builder plugin and when I mass update the plugin using MainWP/ManageWP etc I need to also be able to mass update the new modules on all sites. I can write a plugin and mass update to all my sites, so I was just wondering if there was a function to activate/deactivate modules one-by-one?

Hey Grant,

Thanks for posting! Sorry but what do you mean by mass update the new modules on all sites? Do you mean the custom modules that you’ve created?


Hi Ben,

I need a function with which I can activate / deactivate core modules of the beaver builder. Can you activate/deactive modules using a function?

Hey Grant,

Sorry, I was just confused as to why you needed to update each module. I’m gonna assign another member of the team to assist you with your concern. :slight_smile:


Hi Ben,

Ive just found this filter hook fl_builder_register_module and added the example code but it isnt working

function my_builder_register_module( $enabled, $instance ) {

$disable = array( 'accordion', 'button', 'separator' );

if ( in_array( $instance->slug, $disable ) ) {
    return false;

return $enabled;

add_filter( ‘fl_builder_register_module’, ‘my_builder_register_module’, 9999 );

ive tried doing a var_dump($instance); and echo $instance->slug; and I get NULL.

Can you please look at this for me and let me know what is wrong with my code. Ive tried different priorities also.

Hi Grant,

It looks like that’s not working because your missing the $accepted_args param. I’ve updated the docs to reflect that. Here’s how it should look…

add_filter( 'fl_builder_register_module', 'my_builder_register_module', 10, 2 );

However, I’m not entirely sure this will work for you as it only allows you to disable modules, not enable them. To do that, you might consider working with the “_fl_builder_enabled_modules” option that is stored in the database. That option contains an array of all of the module slugs that are active. If it contains the word “all” then all modules will be active.

You can modify that array using get_option and update_option to add and remove modules that are active.

Let me know if you have any questions about that.


Hi Justin

Great! got it working. I needed it so I can activate / deactive modules for all my clients using a self-hosted plugin. Here is the code I ended up using.

add_action( 'init', 'myweb_update_options' );
function myweb_update_options(){
	// get currently activate BB modules from the db
	$bbactivatedmodules = get_option('_fl_builder_enabled_modules');
	// define the modules we want to be active
	$myweb_bbactivatedmodules = array(
	// if the modules we want activates are already set, do nothing
	if($bbactivatedmodules == $myweb_bbactivatedmodules){return;}
	// else activate the modules we want
		update_option( '_fl_builder_enabled_modules', $myweb_bbactivatedmodules );

Hey Grant,

Very slick! Thanks for sharing. I’m happy to see that you got it figured out.