[wp-trac] [WordPress Trac] #55004: WP_Query IN operator has limits
WordPress Trac
noreply at wordpress.org
Mon Jan 31 10:10:32 UTC 2022
#55004: WP_Query IN operator has limits
---------------------------+-----------------------------
Reporter: hajakutbudeen | Owner: (none)
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 5.9
Severity: major | Keywords: dev-feedback
Focuses: |
---------------------------+-----------------------------
Hello there,
Recently we found one issue, we display products using woo-commerce short
code, we use ids params [products ids=''] to pass all ids in string format
its about 19000 characters. so when we pass args into WP_Query its
generate SQL query for that for
ex:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts LEFT JOIN
wp_wc_product_meta_lookup wc_product_meta_lookup ON wp_posts.ID =
wc_product_meta_lookup.product_id WHERE 1=1 AND wp_posts.ID IN
(111,222,333,444,555,666......19000) etc..
IN operator has limits i think, we exceed that limit due to that WP_Query
response empty. when we run that query in Database its works fine but same
query in class-wp-query.php file.
$this->posts = $wpdb->get_col( $this->request );
not working.
please advise
--
Ticket URL: <https://core.trac.wordpress.org/ticket/55004>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list