#40908 closed defect (bug) (invalid)
HTML Paragraph Tags are omitted in the return value of get_the_content().
Reported by: | digitronixweb | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | template | Cc: |
Description
Hello,
I noticed a minor bug regarding the default Wordpress Post & Page content field.
When getting the value of the default Wordpress content WYSIWYG field using the following snippet:
<?php if(have_posts()) { while(have_posts()) { the_post(); the_content(); } }
The correct HTML formatting is output as expected.
If instead I use the following:
<?php if(have_posts()) { while(have_posts()) { the_post(); echo get_the_content(); } }
HTML tags persist in the resulting value, however, paragraph tags are seemingly omitted from the value return from the call to get_the_content
.
Thanks!
Change History (2)
Note: See
TracTickets for help on using
tickets.
Hello @digitronixweb, welcome to WordPress Trac!
get_the_content()
is not a direct replacement forthe_content()
. Adding paragraphs to the content is handled by thethe_content
filter which only exists inthe_content()
.To get the same content as
the_content()
you have to useapply_filters( 'the_content', get_the_content() )
.