Add paragraph tags to post content in wordpress?

Javier Villanueva picture Javier Villanueva · Mar 8, 2011 · Viewed 14.2k times · Source

I'm getting some pages with the get_pages function and echoing the page content like: $page->post_content, but contrary to the_content(), this way wordpress wont add p tags automatically, is there any way to add them here?

Thanks in advance

Answer

José Carlos picture José Carlos · Mar 8, 2011

You should use <?php echo apply_filters('the_content', $page->post_content); ?>