Closed JDGrimes closed 7 years ago
Well, the is true for the not in conditions at least, which is in fact what led me here (I discovered this because the excluded users are automatically added to the query by the shortcode, and I didn't have any excluded users set).
But for the in conditions, I suppose that if the in is empty that might mean that no results should be returned. I think that the query class already handles this by ignoring the condition in that case though, in which case we'd be fine to ignore the condition as well.
Yes, \WordPoints_DB_Query::prepare_column__in()
does this:
if ( empty( $values ) ) {
return;
}
Might not be the best way to handle it, but regardless of how it is handled, such a query can never return results, so culling the arg from our signatures should be fine.
We might want to consider giving the developer an error instead of going on without the condition, but that is really a separate issue.
Note that for the specific example of the users not in arg, the block signature isn't affected since user args aren't incorporated.
These don't affect the query, so they shouldn't be made part of the query signature. It just wastes space in the database by duplicating the results between queries with the empty condition and those without it.