Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

A friend's heavily customized blog has a category with a specific categoryname-single.php file to display posts.

Apparently for no special reason, since yesterday, the_content() is not returning any content any more for posts in that category, even though the WP back-end is clearly showing content in the post.

All other categories are unaffected.

What I have tried / excluded:

  • There are no PHP errors: I have tried with echo get_the_content() instead, to no avail.

  • I am working on the correct file: When I change something else in the file or hard-code some HTML text in it, it shows up on the page. That also excludes any caching issues

      <? echo "start"; the_content(); echo " end"; ?> // outputs "start end";
    
  • The content is physically missing, it's not just hidden or something: I have inspected the DOM using the DOM inspector, and looked into the HTML source. Where there is supposed to be content, there is nothing.

  • This affects all articles in that category; none of them has been changed for weeks. They are all published.

  • The problem is not caused by some shortcode that doesn't get parsed: I have tried entering pure text into a post, with the same results.

  • There is no loop mix-up: the_ID() returns the correct post ID.

  • The problem occurs for logged-in and not logged-in users.

There has been some installing and uninstalling of plug-ins yesterday, and some editing of files (although purely hygienic measures like removing superfluous comments and such) by the blog owner. I can't exclude that one of these things caused the issue, but I can't really see how.

I'm at my wit's end. My questions:

  • Is there any way to output the raw, unfiltered post HTML to find out whether this is a rogue filter deleting all the content in that specific category for some weird reason?

  • What else could cause a wholesale deletion of content in one category only?

  • Does anybody have any other ideas on how to debug this?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Is there any way to output the raw, unfiltered post HTML to find out whether this is a rogue filter deleting all the content in that specific category for some weird reason?

Yes there is, you can use $post->post_content. Try adding something like:

echo '<pre>'.$post->post_content.'</pre>';

just before the_content() call in your template file.

What else could cause a wholesale deletion of content in one category only?

Since you say that you can see the content in the back end there is no deletion and most probably has something to do with a filter hook, hooked with the_content hook.

try deactivating your plugins and reactivating theme one by one to see which one is causing it. And if that is not it then try switching to the default theme see if that is the cause.

share|improve this answer
    
Excellent, thanks! We will be trying all of this. –  Pekka 웃 Oct 2 '11 at 14:32
    
The solution turned out to be something apparently really obvious - we didn't initialize the_post() in that specific category page. Why it worked before without that remains a mystery to me, but it's one we're not going to investigate further at the moment - just glad it works :) Thanks for your help. –  Pekka 웃 Oct 2 '11 at 19:08
add comment
 if ( have_posts() ) while ( have_posts() )  the_post();

was missing (but not before - strangeways).

share|improve this answer
    
Ehm, could you please clarify what this refers to? Also please do not use answers for discussion. You will be able to leave comments when you gain some reputation on site. –  Rarst Oct 2 '11 at 20:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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