[wp-trac] [WordPress Trac] #55004: WP_Query IN operator has limits

WordPress Trac noreply at wordpress.org
Tue Feb 1 12:50:39 UTC 2022

#55004: WP_Query IN operator has limits
 Reporter:  hajakutbudeen  |       Owner:  (none)
     Type:  defect (bug)   |      Status:  assigned
 Priority:  normal         |   Milestone:  Awaiting Review
Component:  Query          |     Version:
 Severity:  normal         |  Resolution:
 Keywords:  close          |     Focuses:

Comment (by SergeyBiryukov):

 Replying to [comment:2 hajakutbudeen]:
 > If i remove around 3000+ ids from id list then it work. I checked
 already there's no duplicate ids in that list. I dig into that then i
 found this,
 > https://stackoverflow.com/questions/4275640/mysql-in-condition-limit

 As noted in that discussion, you may be running into `max_allowed_packet`
 MySQL value limit on your environment:

 > The number of values in the `IN` list is only limited by the
 variables.html#sysvar_max_allowed_packet max_allowed_packet] value.

 I would suggest rewriting the affected code to query the posts in some
 other way, without passing around a few thousands of IDs.

Ticket URL: <https://core.trac.wordpress.org/ticket/55004#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list