Disable HTML editor in Visual TEXT Widget in WordPress

WordPress has developed a lot as a platform over time. New features, new plugins and new themes have been introduced that are more and more useful for those who use this CMS for websites, blogs and online magazines.

Basic functions (core) added recent versions of WordPress include changes at the level of widgets (Parts). Among these is the addition the widget HTML editor"text"The 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 theme WordPress.

How to disable "Visual" editor in WordPress Widgets

Fortunately for those who use it 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 to 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 WordPress widgets. Stay active for WP Posts, WP Pages and other custom modules.

Passionate about technology, I enjoy writing on StealthSettings.com since 2006. I have a rich experience in operating systems: macOS, Windows, and Linux, as well as in programming languages and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, PrestaShop).

How to » net Surfing » Disable HTML editor in Visual TEXT Widget in WordPress
Leave a Comment