[wp-trac] [WordPress Trac] #62401: WP_Query add extra JOINs after calling get_posts() with category__in in query arguments
WordPress Trac
noreply at wordpress.org
Fri Feb 7 07:22:33 UTC 2025
#62401: WP_Query add extra JOINs after calling get_posts() with category__in in
query arguments
--------------------------+------------------------------
Reporter: elancerteam | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Query | Version: 6.6.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by shahabdev):
The issue you’re facing is likely related to how WordPress handles
taxonomies internally when using category__in. Before calling get_posts(),
WP_Query constructs a straightforward SQL query that retrieves posts
matching the specified categories. However, after calling get_posts(),
additional joins appear because WordPress expands its query structure to
ensure proper filtering, especially when multiple taxonomy terms are
involved.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62401#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list