Title: WP2.5 problem with have_posts function
Last modified: August 19, 2016

---

# WP2.5 problem with have_posts function

 *  Resolved [Jeff Sherk](https://wordpress.org/support/users/jsherk/)
 * (@jsherk)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/)
 * 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)

[←](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/?output_format=md)
[1](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/?output_format=md)
2

 *  [Modifiedcontent](https://wordpress.org/support/users/modifiedcontent/)
 * (@modifiedcontent)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/page/2/#post-725368)
 * 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)

[←](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/?output_format=md)
[1](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/?output_format=md)
2

The topic ‘WP2.5 problem with have_posts function’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 7 participants
 * Last reply from: [Modifiedcontent](https://wordpress.org/support/users/modifiedcontent/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/wp25-problem-with-have_posts-function/page/2/#post-725368)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
