WordPress get_the_content function no paragraph tags

Did you just use the WordPress get_the_content function and realize that all of the line breaks from the visual editor are not being returned as paragraph tags?

Solution: Apply the appropriate filters as outlined in the WordPress codex

<?php
$content = get_the_content();
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);

echo $content; ?>
This entry was posted in Tips & Tricks, Wordpress. Bookmark the permalink.

2 Responses to WordPress get_the_content function no paragraph tags

  1. newton_rocks says:

    thanks man!
    it helped me a lot!
    :)

  2. Juergen says:

    Thanks
    that helped.
    But how did that happen? I have other blog, with the same entries stored inside the database (I checked with phpmyadmin) but where the line breaks don’t disappear.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>