Trying to add modules on a post-type basis.

Hey, loving BB, been developing some plugins and modules that are based around it for a while now.

My issue is, for the latest plugin I’ve been working on, I have a series of modules that are specific to a CPT that I have registered, and I want those modules to appear only on those pages.

I’ve tried using conditionals on get_post_type(), but using the standard hook of ‘init’ to register my BB plugin, I am unable to access this information, and there is subsequently no way to apply this check when booting up the frontend Beaver editor. I tried switching out a couple of hooks (‘wp’ was my first and best bet), but each ended up causing other issues either with Beaver, or didn’t solve my issue.

If you could please help me out with this one, I would be really grateful.

Hi Josh,

I’m glad to hear that you’re loving BB!

Regarding your issue, have you tried the fl_builder_register_module filter? That filter allows you to choose what modules are enabled or disabled. I’m not 100% sure, but I believe you should be able to use that in conjunction with get_post_type. For example, you could do the following…

function my_builder_register_module( $enabled, $instance ) {

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

    if ( 'my-post-type' == $post_type && in_array( $instance->slug, $disable ) ) {
        return false;

    return $enabled;
add_filter( 'fl_builder_register_module', 'my_builder_register_module' );

Let me know if you have any questions about that.



Thanks so much for your help, I’ve implemented this filter in my code and it’s helped to clean it up/make my plugin more Beaver Builder friendly. Unfortunately I’m still having the issue of get_post_type() being out of scope.

I’ve been using it in the plugin declaration file (I have a hierarchy of files and modules built into this), but to no avail. I tried moving the filter into my theme’s functions.php file (Beaver Builder Child Theme), but it appears not to be firing in this context at all.

I know the code you gave me and the filter is working, I can remove modules no problem. The issue arises when I try to do this on a per post-type basis.

Any idea where I could try including this filter that would work for my circumstances?

Hi lycidiae,

I did some testing and it looks like you need to change the action from “init” to “wp” when loading your custom modules to get the post type in the fl_builder_register_module filter. Here’s an example…

function fl_load_module_examples() {
    	if ( class_exists( 'FLBuilder' ) ) {
	        require_once 'basic-example/basic-example.php';
	        require_once 'example/example.php';
add_action( 'wp', 'fl_load_module_examples' );

Let me know if that helps.


We tried that as well. It seems that even though our custom modules are shown correctly in the BB edit page, dropping them on the page doesn’t work as expected – the settings modal is blank.

Hey Josh,

Can you shoot me a copy of your modules? My email is justin [at] fastlinemedia [dot] com.


Figured it out, turns out it was a priority issue. Since it was using a default priority of 10, I assume the secondary order is alphabetical so putting an A in the beginning of the plugin folder name showed the settings. So for anyone else looking to do this, simply use:
add_action( 'wp', 'your_function_here', 1 );

Fantastic! Let me know if you run into anything else. I’m going to update our examples with this in the next release.