WordPress.org

Support

Support » Plugins and Hacks » the_content is wrecking the loop?

the_content is wrecking the loop?

  • I never had this before (and using WordPress for more then 4 years now) but i think the_content is wrecking my loop!

    In my index.php i just run a simple loop, a default one, no strange things at all.

    But when i try to limit this loop to 2 posts per page with:
    query_posts('posts_per_page=2');
    it shows my first post twice and then it just loops on and on, so it doesn’t listen to the query_posts.

    If i remove the_content(); from the loop it runs fine! When the_content is in there it goes wrong!

    I’m using WordPress 3.1.2 running as a multisite

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Mark Jaquith

    @markjaquith

    I don’t know what’s going on there, but you should probably use a better method of changing the posts per page. By doing it the way you’re doing it, you’re creating a second query.

    Try a plugin like this: http://wordpress.org/extend/plugins/cbnet-different-posts-per-page/

    Thanks for you answer Mark!

    I was a little bit complicated. Some plugin (Sexybookmarks) was calling the wp_title() within the loop while an other plugin (WordPress SEO) hooked an filter to the wp_title() which called wp_reset_query()…

    The whole thing was called by the_content because that called the apply_filters functions and on and on and on… 🙂
    So an investigation of two hour brought me to the problem, i reported the issue by both of the plugin programmers.

    Thanks anyway, problem solved!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_content is wrecking the loop?’ is closed to new replies.