[wp-trac] [WordPress Trac] #43238: `suppress_filters` not set in `pre_get_posts` hook

WordPress Trac noreply at wordpress.org
Mon Mar 26 05:49:36 UTC 2018


#43238: `suppress_filters` not set in `pre_get_posts` hook
---------------------------+----------------------
 Reporter:  adampatterson  |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Query          |     Version:  4.9.4
 Severity:  normal         |  Resolution:  invalid
 Keywords:                 |     Focuses:
---------------------------+----------------------
Changes (by SergeyBiryukov):

 * keywords:  reporter-feedback =>
 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 Replying to [comment:3 adampatterson]:
 > Would suppress_filters not be available at all times?

 Yes, `pre_get_posts` runs after the request is parsed and query vars are
 set in `WP::parse_request()`, but before any additional WP_Query arguments
 are processed, including `suppress_filters`, `ignore_sticky_posts`, etc.

 If you need to check the value of those arguments that may or may not be
 passed, I'd suggest using `isset()`, `empty()`, `$query->get()`, or
 `array_key_exists()`, as you did.

 As far as I can tell, there were no changes in behavior here in 4.9.3 or
 4.9.4. Thanks for the ticket though!

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


More information about the wp-trac mailing list