Is there a function to determine if BB editor is active?

I have a function that I don’t want to have run if the BB editor is active. Is there a function or method or variable that I can call that would tell me if the BB editor is currently active for the page?

You can check for the fl_builder GET parameter or use the FLBuilderModel::is_builder_active() function that does the same thing basically.

Thanks… I thought of doing the GET check but wasn’t sure if that was really “safe”. I wasn’t aware of FLBuilderModel::is_builder_active() so thanks for that. Do you have any clue if the later is “safer” or GET works just great? (By “safe” I mean that it is really a very reliable check and there aren’t any gotchas such as being in preview mode)

It really depends where your code is running, the function does a few extra checks but wont work if your code is running too early.

1 Like

Dang… can’t get it to work. No matter what I try the wp action hook always fires at least once.

I’m looking for some conditional so that a php WP action hook won’t run if the BB editor is active. I have some code that I don’t want to run when in BB editor. Something like:

function myStartSession() {
some code…
if(!FLBuilderModel::is_builder_active()) {
add_action(‘wp’, ‘myStartSession’);

I’ve also tried
if(!$_GET[‘fl_builder’]) and can’t get that to work either.

Does that make sense?

As I mentioned on facebook, you are doing it the wrong way around.

You have to do the actions and add your login in the actions to either do something or not. Not the other way around.

OK, I’ll try that. But out of curiosity (if you happen to know), why would the conditional check
if (!is_admin())

work to prevent the action hook loading if in the WP backend admin, but the same logic not work for checking the fl_builder mode?

add_action( 'wp', function() {
	if ( ! isset( $_GET['fl_builder'] ) ) {
		// code that runs when builder is NOT open.

You need to start with something like this.