[wp-trac] Re: [WordPress Trac] #6484: custom permalinks setting (rewrite.php) causes have_posts function not to work outside of 'the loop'

WordPress Trac wp-trac at lists.automattic.com
Tue Apr 8 15:38:41 GMT 2008


#6484: custom permalinks setting (rewrite.php) causes have_posts function not to
work outside of 'the loop'
---------------------+------------------------------------------------------
 Reporter:  jsherk   |        Owner:  anonymous
     Type:  defect   |       Status:  reopened 
 Priority:  normal   |    Milestone:  2.6      
Component:  General  |      Version:  2.5      
 Severity:  normal   |   Resolution:           
 Keywords:           |  
---------------------+------------------------------------------------------
Comment (by Otto42):

 Adding a call to "query_posts" would fix this issue in your code.

 Essentially, the problem is how the rewrite rules match. In 2.3.3, the
 rules didn't match anything in your url and so the result was the normal
 default posts. In 2.5, they match nothing and the result is no posts. The
 behavior has changed, but that doesn't make the behavior incorrect.

 This code:
 {{{
 <?php
 require('wp-blog-header.php');
 while (have_posts()) {
 .. whatever ..
 } ?>
 }}}

 Has always been undefined. The fact that it "just worked" in previous
 versions is coincidence, not by design. You've not specified what posts
 should be displayed, and it can't figure it out from the URL rules, so
 what you get is a bit of a tossup.

 If you added a simple query_posts('showposts=3'); to it, then you'd get
 the latest 3 posts instead, now and forever.

 Recommend closing this as invalid. It's not a bug, it's a change in
 behavior that was previously, and still is, not defined anywhere.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6484#comment:15>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list