Fix WP_Query post__in issue with empty array input

Ticket #28099 https://core.trac.wordpress.org/ticket/28099 Passing an empty array to post__in will return have_posts() as true (and all posts will be returned).

If the post__in array is empty, the query should return no results instead of all posts. Currently to get the expected query result, the post__in argument must be checked for emptiness and the first element of the array set to 0 before passing to WP_Query->set().


Read-only archive: Issues · ClassicPress/ClassicPress · GitHub

Author: Lance Willis

Vote count: 3

Status: open


Comments

This seems to be a breaking change. Do we still need this?

I suggest closing this as a petition, because we aren’t currently in a position to accept breaking changes. But the idea is sound, so we could revisit it when we are.

This topic was automatically closed after 3 days. New replies are no longer allowed.