DevBlogs

How to disable Gutenberg Widget Editor

WordPress

Gutenberg

Theme Development

WordPress

5 minutes read

Restore the Classic WordPress Widgets

There may be number of reasons why you may want to restored the WordPress classic widgets such as theme support or user expectations. Regardless of your reasons there are two methord which you can use to restore the widgets you know and love.

1. Install a Plugin

A great option for non-developers or if your in a rush. WordPress developed their own official plugin to restore the widgets called “Classic Widgets“. Once installed an activated, the previous setting and screens are restored. Back to basics.

2. Update your funcations file.

If you’re a developer and use to making code based changes to your themes then this is the perfect solution for you. No need for extra plugins.

Adding the below lines of code will restored the original widget management panel, retruning your theme back to what your users expect and in the case of custom widgets restored their original look and funcation.

// Disables the block editor from managing widgets in the Gutenberg plugin.
add_filter( 'gutenberg_use_widgets_block_editor', '__return_false', 100 );

// Disables the block editor from managing widgets.
add_filter( 'use_widgets_block_editor', '__return_false' );

It however, is important to remember that if your theme has automatic updates or the ability to update via the WordPress CMS. Any changes made to the functions.php file on the local server and not part of a child theme will be removed when you update it. Make sure to save and upload any code changes into the theme distribution.

Fri, 21 January 2022