The most annoying thing about WordPress is its automatic post formatting. WordPress automatically adds paragraph tags and other necessary tags to your posts. It’s a useful feature, but if you love to play with HTML codes then it’s definitely not for you.
So, is there any way to prevent WordPress from doing that? Yea, there’s a one line solution to this problem. Just add following snippet to your current theme’s functions.php file:
// Remove automatic paragraphs remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );
How can I fix it only for images? eg, I type:
Text here
link
Result should be:
Text here
link
What?
This definitely works, but makes it harder when creating blog posts where the paragraph tags are needed for formatting. Do you know of a solution where you can turn off the auto-p feature by default, but re-enable it for posts? Thanks for the help!