WordPress 2.6 Issue: get_posts() is Broken

get_posts(), a key ingredient for creating multiple loops in WordPress, appears to be broken after on the 2.6 release. Here’s a forum post seeking for help. I first came into this problem from Dan Philibin‘s tweet regarding problem with WPCandy.

This problem would affect many sites, I would imagine, especially those with more complex ways to display its content. I suppose a quick fix is in the way soon.

You may also like...

6 Responses

  1. Holiday Guru says:

    There is a behaviour chaneg in get_posts() but not sure if its intended! It grabs ALL posts now and you have to manually work out if the post is one you want. I set up a sidebar to display posts in the category of teh page you are on using the following code, however it isn’t quite perfect because on Index and Category pages it still reads all posts in the database and uses the latest one as teh default. But it works on articles:

    $found = 0;
    $count = 0;
    $ID = $wp_query->posts[0]->ID;
    $category = get_the_category($ID);
    $cat = $category[0]->cat_ID;
    $catposts = get_posts(‘numberposts=999999&category=$cat’);
    foreach($catposts as $post) :
    $thisID = the_ID();
    $postID = $wp_query->$thisID;
    $postCategory = get_the_category($postID);
    $postCat = $postCategory[0]->cat_ID;
    if ($postCat == $cat && $count
    <a href=””>

  1. July 16, 2008

    […] de tweede bug werd door Dan Philibin van WP Candy (meer info hier) en gaat om het  get_posts() php commando. Een oplossing is nog niet bekend voor zover mij […]

  2. July 18, 2008

    […] de tweede bug werd door Dan Philibin van WP Candy (meer info hier) en gaat om het  get_posts() php commando. Een oplossing is nog niet bekend voor zover mij […]

  3. July 27, 2008

    […] case you’ve forgotten, the 2.6 release also brought at least two different errors: get_posts() and Permalink with “index.php” […]

  4. July 28, 2008

    […] de tweede bug werd door Dan Philibin van WP Candy (meer info hier) en gaat om het get_posts() php commando. Een oplossing is nog niet bekend voor zover mij […]

  5. July 28, 2008

    […] you have a custom theme that uses multiple loops, chances are it uses get_posts. Unfortunately there are several problems with the function in this version, so you might be better off using […]

css.php