Disable HTML editor in Visual TEXT Widget in WordPress

WordPress has developed a lot like the platform over time. New features, new plugins and new themes have become more useful for those who use this CMS for websites, blogs, and online magazines.

Basic functions (core) added recent versions of WordPress include and level changes widgets (Parts). Among these is the addition the widget HTML editor"Text”To WordPress.
A good idea that allows one easier customization from the "Visual" editor, without having to minimal HTML knowledge to add some links or to change the format of a text. There is, however, a problem for those who prefer to edit their own HTML code in "Text”Widget. After publication, there is a possibility to appear "ul"And other HTML elements starting from the editor"Visual”And which on the site no longer looks as it should. So, even if HTML code is added to the widget's "Text" editor, it will be automatically converted to "Visual" and unwanted pieces of code will be added.

The simplest solution is to disable the "Visual" mode in WordPress widgets. We can do this by adding a function function to the functions.php file of the WordPress theme.

How to disable "Visual" editor in WordPress Widgets

Fortunately for those who use WordPress, they can use additional functions, they can activate and deactivate the core functions at any time. All you have to do is access the site's files via FTP or SFTP and edit the files carefully. In our case, to disable the "Visual" editor of the "Text" widget in WordPress, go to the theme folder and add the following code in the functions.php file:

add_filter( 'widget_display_callback', 'clean_widget_display_callback', 10, 3 );
function clean_widget_display_callback( $instance, $widget, $args ) {
$instance['filter'] = false;
return $instance;
}

Save the change, then the Visual Editor will be disabled from WordPress widgets. It remains active for WP Posts, WP Pages and other customized modules.

Disable HTML editor in Visual TEXT Widget in WordPress

About the author

Stealth

Passionate about everything gadget and IT, I write with pleasure on stealthsettings.com since 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment