Skip to content

Instantly share code, notes, and snippets.

@Pross
Created January 4, 2020 12:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Pross/b810dede5588bb1e3fdcebac445943c0 to your computer and use it in GitHub Desktop.
Save Pross/b810dede5588bb1e3fdcebac445943c0 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Beaver Builder Global JS Reset
Description: Resets global JS and self deactivates.
Author: <Simon>
Version: 1.0
*/
class BB_Global_JS_Reset {
function __construct() {
include_once ABSPATH . '/wp-admin/includes/plugin.php';
$settings = get_option( '_fl_builder_settings' );
$settings->js = '';
update_option( '_fl_builder_settings', $settings );
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die(
'Global JS has been reset.',
'Global JS Reset',
array(
'link_text' => 'Back to dashboard',
'link_url' => admin_url(),
)
);
}
}
new BB_Global_JS_Reset;
@carlosonweb
Copy link

This is very useful for fixing JS issue in the BB Global JS.

@JohnZint123
Copy link

JohnZint123 commented Nov 27, 2020

Hi @Pross, I have Beaver Builder here. I put a wrong code on JS Global site settings. Would this code works and won't affect my website?

@benklocek
Copy link

How would I use this to clear the JS on a particular page?

@carlosonweb
Copy link

@benklocek, try the following:

  • Navigate to the plugins directory.
  • Create a directory named 'bb-global-js-reset'
  • Copy to the 'bb-global-js-reset.php' to that directory
  • Go to the Plugins Dashboard and activate the plugin. Note: it will self-deactivate.
  • Check the BB Global JavaScript code. It should be cleared.

I just tried it on my local install and it works.

@carlosonweb
Copy link

carlosonweb commented Dec 23, 2020

How would I use this to clear the JS on a particular page?

@benklocek It's meant to clear the JavaScript code from the Global Settings.

https://www.screencast.com/t/XiGEKlasYeB

@benklocek
Copy link

benklocek commented Dec 23, 2020 via email

@Pross
Copy link
Author

Pross commented Dec 23, 2020

Thanks Carlos! I actually need it on the page, not the global settings. Anyway to get it to reset just that JS?

On Tue, Dec 22, 2020 at 4:26 PM Carlos Velasco @.> wrote: @.* commented on this gist. ------------------------------ How would I use this to clear the JS on a particular page? It's meant to clear the JavaScript code from the Global Settings. https://www.screencast.com/t/XiGEKlasYeB — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://gist.github.com/b810dede5588bb1e3fdcebac445943c0#gistcomment-3570439, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACHXRBAG45LIT3YC6S5FXDSWE2IDANCNFSM4KQSUT3Q .

Just go to wp-admin bb settings, enable debug mode.

You can now edit global js/css and if you go to a specific page/post in wp-admin you can edit the css/js there. This was basically added to the core bb plugin a while ago :)

@benklocek
Copy link

benklocek commented Dec 23, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment