[wp-trac] [WordPress Trac] #39483: Use $wp_the_query for the main loop and pagination

WordPress Trac noreply at wordpress.org
Thu Jan 5 16:22:17 UTC 2017


#39483: Use $wp_the_query for the main loop and pagination
-------------------------+------------------------------
 Reporter:  prosti       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Query        |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:2 prosti]:
 > `query_posts()` and altering the main loop? Some believe that this is
 not so good idea.
 > Instead they advice `pre_get_posts` action hook to do that. (WPSO)

 That's correct.

 [https://codex.wordpress.org/The_Loop#Nested_Loops Custom loops are
 already possible] using `new WP_Query()`, I don't see the need to change
 `query_posts()` for that.

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


More information about the wp-trac mailing list