user2986959
user2986959

Reputation: 135

Don't want my WordPress editor to remove <br> and <p> tags

I don't want my WP editor to remove br and p tags when I'm saving and I don't want to install TinyMCE to achieve it. Just want to use br and p tags in WP default editor.

Is there a good way?

Upvotes: 3

Views: 3366

Answers (2)

Adam Marshall
Adam Marshall

Reputation: 712

Bit of a necro, but for the <p> tag you can add a class or perhaps another property.

e.g.

<p class="nothing-relevant">Foo</p>

will not be stripped (using Gutenberg).

Upvotes: 1

Devin
Devin

Reputation: 7720

there are plugins that are more accurate, but you can just add these lines in functions.php

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );

See more info here

Upvotes: 0

Related Questions