Skip to content

Instantly share code, notes, and snippets.

@Pross
Created January 4, 2020 12:56
Show Gist options
  • 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

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