[wp-trac] [WordPress Trac] #28383: Adding have_the_post() as a shortcut to have_posts() and the_post() loops

WordPress Trac noreply at wordpress.org
Wed May 28 16:48:41 UTC 2014


#28383: Adding have_the_post() as a shortcut to have_posts() and the_post() loops
-------------------------+------------------------------
 Reporter:  sc0ttkclark  |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------
Changes (by sc0ttkclark):

 * focuses:  template =>


Comment:

 Replying to [ticket:28383 sc0ttkclark]:
 > because how many use cases are there really for using have_posts()
 without the_post()?

 I wanted to clarify this point further, not saying that this is designed
 to replace all usage of have_posts(), but all usage of have_posts() that
 also uses the_post() '''right after have_posts()''', specifically in
 while() loops.

 There are literally no uses of `while( have_posts() )` that I can find
 without a call to `the_post()` directly after it. Not in core, not in most
 of the plugins I've seen use it, nor cases of custom WP_Query objects
 calling via `while( $query->have_posts() )`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28383#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list