J.me

If the_content stop working after upgrading to WordPress 3

Well, this is one common problem happened after upgrading to WordPress 3. After upgrading to WordPress 3, the content is not displayed. This is happened likely because you don’t call the_post before you call the_content.

In previous version of WordPress, when we are on single/page, this worked fine. Some themes didn’t go into the WordPress loop on single/page template, since WordPress already know which page/post to show. This also make sense, single/page only have 1 post to be displayed, so we shouldn’t need to get into the WordPress loop. However, in the recent version, the_content failed to display anything if you don’t call the_post beforehand.

I’m not sure which one should be the correct behavior. In codex, it’s pretty clear that we still need to get into WordPress loop, even though we are in single/page template. However, in theory, calling the_post before calling any other function that supposed to be in the loop should fix it.

Just a quick note, I don’t want to forgot this trivial stuff when I got this problem again in future. 🙂

3 comments | Leave a comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.