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: https://petitions.classicpress.net/posts/155/fix-wp_query-post__in-issue-with-empty-array-input

Author: Lance Willis

Vote count: 3

Status: open


Comments