NO BUG: Bug, but not in Bricks. How could I deactivate plugins in Bricks editor?

Dear Team,

I use a plugin: “Email Encoder - Protect Email Addresses”

The newest version just breaks Bricks Buildr editor. If they will solve this issue I still have a problem with Bricks form as this plugin encodes e-mail address even in Bricks form. Very easy to make the form useless as the encoded email address will not work.

How could I disable other plugins only in Bricks editor?

Thank you, Andrew

Not the same thing, but would this help?

Otherwise, there is a PHP condition

if ( is_bricks_builder_main ) { we’re in the builder }
if ( !is_bricks_builder_main ) { We’re not in builder }

I’m afraid I’m not sure how you’d unhook the encoder with this… but maybe their support could suggest something.

Hey Andrew,

thanks for your report.

It’s probably best to contact their support in this case. Seems like they know that there are compatibility issues with some plugins and themes. Sounds like they’re happy to address them:

Best,

André

Dear @digismith and André,

thank you for your answers. I wrote to the developer but I don’t see any solution from him.

But it is not a problem. This is a generic problem: Bricks Builder runs as it is a frontend page.

So I need a solution for disable plugins inside Bricks Builder editor view. I tried this:

<?php

function deactivate_plugin_on_specific_url() {
    $current_url = $_SERVER['REQUEST_URI']; // Get the current URL

    if (strpos($current_url, 'bricks=run') !== false) { // Check if the specific part exists within the current URL
        deactivate_plugins('email-encoder-bundle/email-encoder-bundle.php');
    }
}
add_action('admin_init', 'deactivate_plugin_on_specific_url');

Somehow this is not working. Where did I fail?

Thank you and best regards, Andrew

This issue is solved by the writer of the plugin.
I still would like to know how I could deactivate plugins only in editor mode.
Best regards, Andrew

I’d be interested to know more about the plugin authors solution.
As for deactivating plugins. You shouldn’t activate/deactivate plugins this way AFAIK. Plugins should have hooks/methods for filtering/disabling them where needed, but it’s not good practice to completely disable them.

1 Like

I agree. The method above what I wrote is not a solution. Actually it works but for everyone, what means on frontend too. And somehow I should activate the plugin again, but when. I can do it by hand what is not a good solution as I could forget it. So there should be a solution for this task but a completely other way.