• Resolved robw

    (@robw)


    Hi Everyone!

    Sometimes using the_content() in my theme will not display any content for some, but not all, posts. (I have verified there is content using $post->post_content.)

    I’ve tracked the problem back to line 79 in wp-includes/post-template.php:

    $content = apply_filters('the_content', $content);

    If I comment out this line, the_content() will work. This is not a workable solution, however, as all the formatting WP does before displaying content is removed for all posts, throwing the baby out with the bathwater.

    I’m wondering if its something in wpautop() in wp-includes/formatting.php that’s stripping out all the content, but this is just a shot in the dark. I’m not sure what filters are applied to the_content.

    Has anyone else had this problem or shed some light on this?

Viewing 1 replies (of 1 total)
  • Thread Starter robw

    (@robw)

    Just an update in case anyone was wondering. ??

    It turns out my intuition was correct. The culprit was indeed the wpautop() function in wp-includes/formatting.php after all. Lines 97-98 handle pre tags and the disappearing posts all used this tag.

    Commenting out lines 97-98 fixed the problem. I’m not crazy about modifying WordPress core, but it works for now, fwiw.

Viewing 1 replies (of 1 total)
  • The topic ‘get_content does not display some posts’ is closed to new replies.