By default, WordPress automatically add paragraph tags to the content and the excerpt, using the wpautop() function. If you need to automatically add some <p> tags to any text, you can use the function as shown in today’s example.
In order to add paragraph tags to any text, simply use the wpautop() function, as shown below:
$my_text = 'Lorem ipsum dolor sit amet consectetur adipiscing elit. Nulla pretium libero eget gravida rutrum.'; echo wpautop( $my_text );
Thanks to Daniel Pataki for the tip!
