• Resolved Jeff Sherk

    (@jsherk)


    Can somebody test the following code and let me know what the outcome is? I have some custom code that extracts recent posts from different blogs (seperate WP installs) and displays them on a page outside the blog. But since I upgraded to 2.5, the have_posts function returns nothing even though there are posts in the blog. Put this test code in a php file and put in your main blog diretory, and then call it and let me know if anybody gets a “1” back from have_posts:

    require('wp-blog-header.php');
    
    $myid=10; //put a post id here that you know is valid
    
    $mytest = get_post($myid);
    
    echo "Known good post id ".$myid." returns: ".$mytest->post_title;
    
    $mytest = have_posts();
    
    if ($mytest=="") { $mytest="nothing"; }
    
    echo " and have_posts() returns: ".$mytest;

    The interesting thing is that within ‘the loop’ on my blog have_posts works fine, but from within this program (using wp-blog-header) it does not appear to be working. This code worked fine on WP 2.3

    Thanks to anybody that can test this.

Viewing 16 replies (of 16 total)
  • I have the same problem. I have WordPress installed in a /blog folder. Including WP posts in the index.php at the root works fine.

    But then when I turn on Permalinks, I get ‘Sorry, no posts matched your criteria’ on the homepage.

    I see a lot of suggested fixes in this thread, but they all look very messy. Is there an “official” solution?

Viewing 16 replies (of 16 total)
  • The topic ‘WP2.5 problem with have_posts function’ is closed to new replies.