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/
Related Posts:
- Is it possible to handle a specific section of a post separately?
- $content = $post->post_content; with formating
- How to get ‘post_content’ without stripping tags?
- Why is the_content() not displaying the content? [closed]
- Insert Custom HTML After Shortcode
- Heartbeat API oEmbed
- Apply the_content filter for specific post types only
- How to to stop html editor from addig tags to shortcodes, images, etc
- Static page homepage not showing the_content
- How to add an inline style to the tag outputted in the_content() using PHP?
- Word limit in post_content after more tag
- Format content value from DB outside of WordPress filters
- Is it possible to change the contents of “the_content()”?
- How to encode post content as JSON?
- How to output only the post content
- How I can split text in the_content() into 2 columns?
- How can I show the actual content of Posts page because the_content() is showing all blog content?
- the_content() isn’t showing content, but $post->post_content does
- preg_replace Remove comment text in content
- tag the_content()
- Add span to the first letter of post
- WordPress replacing all line breaks in comments with “rn”
- Proper use of the_content filtering
- put the content of a single post into og:description
- the_content is always surrounded by paragraphs (how to disable or remove them)?
- Filter the_content() in the Quote Post Format to Display Quotes
- How to count rows of table in the_content()
- WordPress get_the_content get child element like p value
- How to make search and replace in content through php
- Strip links from the_content
- Concatenate a Function to the Post Content
- How to change the position of Jetpack sharing icons? [closed]
- embed the_content
- Hook midway through the_content();?
- Appending code to the_content
- Missing content in Pages only
- Short Overview in AMP Version and Link to full article non-amp [closed]
- Add Attribute to p Tag of Post Content
- Changing Image Size In The Content tag
- the_content() – Getting formatted text
- limit how many words show up in the_content on index
- How can I display “read more” without any other post text?
- WordPress appends the_content filtered text inside last paragraph tag of content (rather than after it)
- WordPress adding content into different sections
- How to keep before/after text inline with nl2br and the_content()
- removing tags around img, iframes and also scripts
- Should I find/replace values in the_content?
- Remove images from the_content [duplicate]
- Query does not return content
- Content DISAPPEARS when simply adding normal text for ONE POST ONLY
- How do I show current post content in the header?
- strip_tags in get_the content
- custom page with post content using read more
- Insert div after h2 in content
- the_content() returning unexpected div wrappers
- How can I output the content of the page using this code?
- filter h1 tag to add a word at the beginning of the text
- the_content() brings the medium size image [closed]
- Checking post content for a shortcode, but content is being returned as empty
- How can i specify the size of the image rendered by the_content();?
- content and excerpt not displaying
- Get Content Limit?
- Append data to the_content within the database (not using filter)
- Post Format Link Validation Error
- the_content returns blank when adding SEO details
- how to include page content to specified length & then “read more” link
- How to add multiple the_content or something like that?
- Get specific Blocks from Post
- Is there a difference in usage of the_title() and the_content()
- How to show Social share buttons outside the post?
- WordPress v5.4.2 escapes the content of Edit Attachment > Description field
- how can i take wordpress post as embed?
- Remove pre and code tags from WordPress
- auto link word link in content
- One Content Filter To Rule Them All
- Extract links inside embed tags in WordPress
- Looking to limit the number of characters on my post page
- after setup_postdata, the_content() only displays text before the read more tag
- Remove P tag from images if aligncenter class is set
- Call the content help
- Remove a div with ID from the_content WordPress
- wp_content text length and displaying ‘more’ for the full text
- Why is every single HTML tag being stripped out of liveblog entries?
- Cannot Find Hook that is changing the_content()
- get_post_fields as an excerpt
- the_content inside my own theme does not retain line breaks / enters like in the admin
- the_content() not working in my Android mobile
- Read more link for blog listing page
- Add read more to the_content
- pre_get_posts returning unformatted page
- Plugin scans for images in post_content, how about “featured image”?
- How to replace text in hompage only
- How do I remove the title from the_content
- Exactly where I have to insert get_next_post_link() in a post?
- Does WP have a hook for the use of wp_trim_words?
- I want a part of the_content be under custom post types
- Find and replace weird characters in the_content [closed]
- How to remove only images from the_content() [duplicate]
- Adding schema to text content in the loop, how?
- How can I customize the_content(); output? [closed]