Subscribe On YouTube

Join other subscribers and enjoy other Divi video tutorials!

How To Use The ESC Key To Enable Or Exit The Divi Visual Builder

Nelson Miller Profile Orange
In this tutorial I will show you how to use the ESC key as a handy shortcut to enable and exit the Divi Visual Builder.

▶️ Please watch the video above to get all the exciting details! 👆

How To Use The ESC Key To Enable And Exit The Divi Visual Builder Using A PHP Code Snippet

If you do not own Divi Assistant plugin or are not a member of our Divi Adventure Club membership, you can hide the blue button to explore more Divi modules with a snippet of PHP code instead. This is for those who are more experienced, so just please be careful when adding PHP code to your site, as it can very easily crash your site if you have any typo or place it incorrectly. We have links to instructions here if you need them.

Where To Paste The PHP Code

1. Divi Assistant
If you are using our Divi Assistant plugin, simply paste the code in the PHP tab in the custom code window in the Divi Visual Builder.

2. Child Theme
If you are using a child theme, paste this code into the functions.php file. If you don't have a child theme, you can generate a child theme directly on your site or download our free child theme.

3. Code Snippet Plugins
Otherwise, install a dedicated code snippet plugin, create a new snippet, and paste this code into the PHP code editor.

If you need help understanding where to paste the code, please check out our complete guide about where to add custom PHP code snippets in Divi.

function pac_add_custom_script_to_enable_disable_VB() {
    wp_enqueue_script('jquery');
    ?>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $(document).keyup(function(e) {
                if (e.keyCode === 27) {
                    let builderKey = document.location.href.indexOf("?et_fb=1&PageSpeed=off");
                    if ($('body').hasClass('logged-in')) {
                        if (builderKey >= 0) {
                            if ($('li#wp-admin-bar-et-disable-visual-builder>a').length > 0) {
                                $('li#wp-admin-bar-et-disable-visual-builder>a')[0].click();
                            } else {
                                window.location.href = document.location.href.substring(0, builderKey);
                            }
                        } else {
                            if ($('li#wp-admin-bar-et-use-visual-builder>a').length > 0) {
                                $('li#wp-admin-bar-et-use-visual-builder>a')[0].click();
                            } else {
                                window.location.href = document.location.href + '?et_fb=1&PageSpeed=off';
                            }
                        }
                    }
                }
            });
        });
    </script>
    <?php
}
add_action('wp_head', 'pac_add_custom_script_to_enable_disable_VB');
Use The Escape Key To Enable and Exit The Divi Builder using the Divi Assistant plugin

Subscribe For More Things Like This!

At the start of each month, we send out a recap newsletter from the month before with family news, Divi news, our latest tutorials, and product news. Occasionally, if the news is too exciting to wait, we will send out another email separate from the monthly newsletter. That’s what you get when you subscribe, and of course you can unsubscribe if you are no longer interested!

Blog Post Optin

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

0

Your Cart