Opened 7 years ago
Closed 7 years ago
#40239 closed defect (bug) (invalid)
Getting posts by post_name is broken
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.8 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
Getting posts by the post_name, or slug, is currently broken... or the documentation is broken:
<?php var_dump(get_posts( array( 'post_name' => 'anyreallyuniquename', 'post_status' => 'any' )));
Why in the world should this be a listing of 5 recent posts?
Change History (1)
Note: See
TracTickets for help on using
tickets.
@programmin,
The correct argument is
name
rather thanpost_name
, there's an example on the dev reference site. For a full list of arguments, seeWP_Query:parse_query()
's documentation but be aware there are some differences in behaviour.I'll close this ticket off for now but feel free to followup if I'm missing something.