[wp-trac] [WordPress Trac] #11698: have_posts should not auto rewind

WordPress Trac wp-trac at lists.automattic.com
Sun Jan 3 00:51:49 UTC 2010


#11698: have_posts should not auto rewind
--------------------------------------+-------------------------------------
 Reporter:  mwillberg                 |        Owner:         
     Type:  defect (bug)              |       Status:  closed 
 Priority:  normal                    |    Milestone:         
Component:  General                   |      Version:         
 Severity:  minor                     |   Resolution:  invalid
 Keywords:  dev-feedback 2nd-opinion  |  
--------------------------------------+-------------------------------------

Comment(by filosofo):

 Replying to [ticket:11698 mwillberg]:
 > documentation and examples are not valid as they claim that have_posts()
 will return false when there are no more posts in query.

 {{{have_posts()}}} does return false once the Loop is completed.  Perhaps
 the documentation you mention could be improved.  Can you link to an
 example that is in error?

 > Example, this will incorrectly go thru the loop twice:
 >
 > [[br]]
 > {{{while (have_posts()) {the_post();the_title();}}}} [[br]]
 > {{{while (have_posts()) {the_post();the_title();}}}}
 >

 Restoring the global variables to their pre-Loop state is intended
 behavior.  See #977 and #1518

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11698#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list