Opened 10 years ago
Last modified 8 months ago
#28099 closed defect (bug)
Empty array passed to WP_Query post__in returns posts — at Initial Version
Reported by: | danielbachhuber | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
When you pass an empty array to post__in
, you get the most recent posts.
I'd expect that passing an empty array would produce no results.
#12212 is a previous conversation on the matter with the https://core.trac.wordpress.org/ticket/12212#comment:26|determination:
Strongly tempted to wontfix based on other comments in this thread, specifically dd32's comment about A) consistency in arguments, and B) "I personally believe it's cleaner for the theme to check before it mindlessly queries for data"... Moving to future release for now, suggested close.
However, instantiating a WP_Query
object and using if ( $query->have_posts() )
is a valid, and cleaner, approach in a template.
Note: See
TracTickets for help on using
tickets.