I have big trouble with the_content() for single.php.

Whats my problem?

  • the_content() doesn't give any output on single pages
  • furthermore it crashes (no other PHP code below the function call is executed
  • There are no PHP or database errors shown
  • On all other page and post types the_content() works

What I have done/checked so far

  • deactivated all plugings -> no success
  • used original Wordpress themes -> no success
  • checked twice if the_content() is inside the loop -> it is inside
  • tried to use $post->post_content -> gives output, but I want to use the_content()
  • $textt = get_the_content(); echo $textt; -> Works also, so where's the difference between get_the_content and the_content, which keeps the_content from working as supposed to

So it seems that the problem is theme and plugin independent. I use Wordpress 3.8 and also tried to reinstall the via the update function.

  • Do you have WP_DEBUG enabled? Check server logs, sometimes PHP gets confused so bad it crashes Apache before it can generate error. – Rarst Jan 8 '14 at 20:56
  • Can you copy / paste The Loop into your question? Have you tried the default theme? – Howdy_McGee Sep 1 '15 at 16:45
  • Post your loop code and anything else that could affect it. – gdaniel May 9 '16 at 21:45

the_content( ); vs get_the_content(); The different is pretty simple actually. If you find yourself annoyed with formatting of the content, more specifically the added p-tags that WordPress puts into the content that you didn’t. Just use get_the_content(); and you will remove those tags.

Normally the get_the_content() tag returns the content WITHOUT formatting. Only the_content() will print the content WITH formatting.

echo apply_filters('the_content', $post->post_content);

  • Yeah, but I want to use the_content(). I asked for the difference to find the point, which keeps the_content() from working correctly. So also apply_filters('the_content') is broken. So I think if I could get the "the_content" filter fixed, the_content() would also work again. But I have no idea how to fix it. – netblognet Jan 8 '14 at 10:42
  • use this code pass second perimeter value. echo apply_filters('the_content', $post->post_content); – Ravi Patel Jan 8 '14 at 10:46
  • Unfortunaely this doesn't work, because the 'the_content' filter is broken. But I don't know why. Wordpress is freshly installed and even with twentyforteen theme and no plugins it doesn't work for single page. For main page and pages it does work. – netblognet Jan 8 '14 at 11:02
  • This code is worked on 3.8 theme fourteen in single.php so your code in mistake please add your code. – Ravi Patel Jan 8 '14 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.