Can the new 4.8 widget visual editor in the default text widget be unhooked or removed and the widget restored to the pre-4.8 editor style?

I don’t need or want the visual editor in widgets; I use them for plain text and html and don’t need other users adding anything other than plain text.

I did learn how to remove the new video, audio and image widgets in functions.php as I don’t need them:

// Unregister default WP Widgets
function unregister_default_wp_widgets() {
    unregister_widget('WP_Widget_Media_Audio' );
    unregister_widget('WP_Widget_Media_Image');
    unregister_widget( 'WP_Widget_Media_Video' );

}
add_action('widgets_init', 'unregister_default_wp_widgets', 1);

But I also want to remove the visual editor tab from the default text widget.

Edit: I can use the PHP Code Widget https://wordpress.org/plugins/php-code-widget/ which does not have the visual editor, and though I don’t usually need php execution, it is useful. But this adds the “break things” vector for users who might play with php.

3 s
3

The answer is mostly no. The “enhanced” text widget was designed to work like the post editor as much as possible, including autop which might break whatever HTML that can not stand the conversion of lines into paragraphs.

Several people have released plugins to restore the former functionality, but 4.8.1 will also include an “code” widget that can be used to add unaltered HTML. The problem is that there is no, and unlikely to be a plain upgrade path. Best advice right now if you use the html widget is to skip 4.8 and wait for 4.8.1 and allocate some time in advance to migrate the widgets.

If you are just looking to hide the “visual” tab, you are most like also out of luck best to open a ticket at trac to add such possibility, specifically for the widget without impact on the post editor (4.8.1 plan right now is to use the same setting for both)

Leave a Reply

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