[wp-trac] [WordPress Trac] #29484: "posts_per_page" also restricts the number of images in a gallery

WordPress Trac noreply at wordpress.org
Wed Sep 3 06:22:30 UTC 2014


#29484: "posts_per_page" also restricts the number of images in a gallery
--------------------------+----------------------
 Reporter:  Avantart      |       Owner:
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Gallery       |     Version:  3.9.2
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:  ui
--------------------------+----------------------
Changes (by SergeyBiryukov):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Yes, `pre_get_posts` runs for all queries.

 To avoid unexpected results, you should make sure you're only changing the
 value for the main query on front-end, and return early otherwise:
 {{{
 if ( is_admin() || ! $query->is_main_query() ) {
         return;
 }
 }}}

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


More information about the wp-trac mailing list