Remove automatic paragraph from wordpress widget

I’ve just done with my first wordpress theme. My problem is, when I create a new text-widget, the output gets automatically added in paragraph and I also see <br /> tag inserted after every line. Can anybody help me here!

I’ve added remove_filter('the_content', 'wpautop'); to my functions.php but it doesn’t worked.

Related posts

Leave a Reply

5 comments

  1. Maybe this can help you (or others too):

    // remove <br> tags from text widget content, from 4.8 version WP adds these tags
    remove_filter('widget_text_content', 'wpautop');
    
  2. Option #1:

    Go to widget page, edit your text widget and uncheck checkbox under textarea.
    how to remove paragraphs from text widget content

    Option #2:

    Create your own hook, it will have influence on all text widgets:

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