post_content with line breaks

I believe this should work:

$getPost = get_the_content();
$postwithbreaks = wpautop( $getPost, true/false );
echo $postwithbreaks;

The second argument in wpautop can be up to you whether it’s true of false, see the link below. It is described as follows:

(bool) (Optional) If set, this will convert all remaining line breaks after paragraphing. Line breaks within <script>, <style>, and <svg> tags are not affected.

Default value: true

Source:
https://developer.wordpress.org/reference/functions/wpautop/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)