Timeline for WP_Query vs get_posts
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 10, 2017 at 18:11 | comment | added | Milo |
Post type defaults to any in certain circumstances, like a search or some tax queries. Run a new WP_Query and pass only posts_per_page , it will default to post.
|
|
May 10, 2017 at 18:01 | comment | added | Tom Auger |
@Milo Are you sure? Look at class-wp-query.php lines 1742 - 1746. I believe the default for post_type is "", or "any" for tax queries. The docs seem to support this as well.
|
|
May 8, 2017 at 23:23 | comment | added | Milo |
WP_Query has those same post type and status defaults.
|
|
May 8, 2017 at 19:45 | history | answered | Tom Auger | CC BY-SA 3.0 |