Make WordPress Core

Opened 5 years ago

Last modified 5 years ago

#46281 new defect (bug)

WP Query breaks if there are term_ids in tax_query are more than 192

Reported by: seldimi's profile Seldimi Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.0.3
Component: General Keywords:
Focuses: Cc:


I have faced a very wired issue. I am using a WP_Query to get custom posts (more specific 'product') with a tax query of around 193 term_ids as array as NOT IN. The wired problem is that WordPress adds odd term_ids in the $query->request... It works great until I have 192 term_ids, but if I add more, the query gets wired and blocks everything.

I am attaching the args and the query on a txt file.

Check that I dont filter term_category 239 but you will see it in request

Attachments (2)

bug.txt (3.9 KB) - added by Seldimi 5 years ago.
Args and request
bug.2.txt (3.8 KB) - added by Seldimi 5 years ago.
Correct file!

Download all attachments as: .zip

Change History (6)

5 years ago

Args and request

#1 @javorszky
5 years ago

Hi @Seldimi ,

When you say "gets wired and blocks everything.", what do you mean? What's the error message in the logs?

#2 @Seldimi
5 years ago

Hello again.
Sorry for not being specific in post. Well the sql generated from the WP Query adds more terns than those I give on arguments

If you check my attached file you will see an array of 193 term ids I want to add on the wp query.
If you see the generated query, it automatically adds more terms than I supplied.

Eg Term 239 is not on args but it’s on query generated! If I limit terms to 191, everything works normal.

#3 @javorszky
5 years ago

I've just noticed that your args structure is wrong. The tax query -> terms contains itself again. Can you double check that the args are correct?

#4 @Seldimi
5 years ago

Sorry was wrong on copy paste.. The query is working really well and used to be working for years. It's on a plugin I have made and it's used over 100 wordpress installations.

It's just the first time we had a website that needed over 192 terms. Can you simulate it somewhere?
Pretty odd but I'm sure I'm not doing anything wrong.

5 years ago

Correct file!

Note: See TracTickets for help on using tickets.