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.
Maybe this can help you (or others too):
As of WordPress 4.8 the “Automatically Add Paragraphs” checkbox on the text widgets has been removed.
However there is a plugin I wrote in the repository to add the checkbox back in.
https://wordpress.org/plugins/add-paragraphs-option-to-text-widget/
Option #1:
Go to widget page, edit your text widget and uncheck checkbox under textarea.
Option #2:
Create your own hook, it will have influence on all text widgets:
By default, WordPress has an “Automatically Add Paragraphs” checkbox on the text widgets which allow you to turn off the paragraphs.
Add below code in functions.php
// Remove automatic paragraph from wordpress widget
remove_filter( ‘the_content’, ‘wpautop’ );