Disable HTML editor in Visual TEXT Widget in WordPress

WordPress has developed a lot as a platform over time. New functions, new plugins and new themes have been added, which 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 also include changes at the level of widgets (tracks). Among them is the addition the HTML editor for the widget-ul “Text” al WordPress.
A good idea, what allows it easier customization from the editor “Visual”, without needing to minimal knowledge of HTML to add some links or change the format of a text. There is still a problem for those who prefer to edit their own cod HTML in “Text” widget. After publication, there is a possibility to appear “ul“-s and other HTML elements started from the editor “Visual” and which on the website no longer looks as it should. So, even if an HTML code is added in the editor “Text” of the widget, it will be automatically converted to “Visual” and unwanted pieces of code will be added.

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

How we disable “Visual” editor in WordPress Widgets

Fortunately for those who use WordPress, they can use additional functions, they can activate and deactivate 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 editor “Visual” of the widget “Text” from 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 made, then the Visual editor will be disabled from WordPress widgets. It remains active for WP Posts, WP Pages and other custom modules.

Passionate about technology, I write with pleasure on stealthsetts.com starting with 2006. I have a rich experience in operating systems: Macos, Windows and Linux, but also in programming languages ​​and blogging platforms (WordPress) and for online stores (WooCommerce, Magento, Presashop).

Home Your source of IT tutorials, useful tips and news. Disable HTML editor in Visual TEXT Widget in WordPress
Leave a Comment