Make WordPress Core

Opened 15 years ago

Closed 14 years ago

#13352 closed defect (bug) (wontfix)

get_children() displays drafts by default

Reported by: layotte's profile layotte Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch 2nd-opinion
Focuses: Cc:

Description

Was working with get_children and noticed that it was displaying some draft pages. According to the current documentation (http://codex.wordpress.org/Function_Reference/get_children) the default is "any" for post status:

$argspost_status?

(string) Any value from the post_status column of the wp_posts table, such as publish, draft, or inherit; or the keyword any. Default: any

I believe it should act like get_posts --- the default should be "publish" for posts and "inherit" for attachments.

Attached is my diff with the fix...

basically I removed the $defaults setting of 'post_status' => 'any'... and I let get_posts handle the logic.

Attachments (1)

post.php.diff (402 bytes) - added by layotte 15 years ago.
get_children -- remove default post_status = any

Download all attachments as: .zip

Change History (7)

@layotte
15 years ago

get_children -- remove default post_status = any

#1 @layotte
15 years ago

  • Cc lew@… added

#2 @layotte
15 years ago

  • Keywords has_patch needs_testing added; has-patch get_children removed

#3 @layotte
15 years ago

  • Keywords has-patch needs-testing added; has_patch needs_testing removed

#4 @nacin
15 years ago

  • Keywords 2nd-opinion added; needs-testing removed
  • Milestone changed from Awaiting Review to 3.1

Should either be committed or wontfixed. This sounds like it could break things.

#5 @layotte
15 years ago

Yeah, in my opinion, it would only negatively affect people/places that are trying to get draft children and are using the default 'any' status. Pragmatically, I can't imagine why anyone would want that as default behavior... but I'm only looking at it from my use cases.

#6 @nacin
14 years ago

  • Milestone 3.1 deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.