[wp-trac] [WordPress Trac] #50885: Setting a pre_get_posts query post_type to array results in broken wp-admin filters
WordPress Trac
noreply at wordpress.org
Mon Aug 10 13:39:39 UTC 2020
#50885: Setting a pre_get_posts query post_type to array results in broken wp-admin
filters
--------------------------+------------------------------
Reporter: matpratta | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 5.4.2
Severity: normal | Resolution:
Keywords: | Focuses: administration
--------------------------+------------------------------
Changes (by SergeyBiryukov):
* component: Administration => Query
Comment:
Hi there, welcome back to WordPress Trac! Thanks for the report.
Just noting that it's generally recommended to include `! is_admin() &&
$query->is_main_query()` checks when using `pre_get_posts`, so that the
correct queries are altered. See
[https://developer.wordpress.org/reference/hooks/pre_get_posts/#targeting-
the-right-query Targeting the right query].
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50885#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list