-
-
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; |
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 It's meant to clear the JavaScript code from the Global Settings.
https://www.screencast.com/t/XiGEKlasYeB