Make WordPress Core

Opened 16 years ago

Closed 16 years ago

#8527 closed defect (bug) (fixed)

default get_children behavior broken

Reported by: filosofo's profile filosofo Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: get_children post_status post_type
Focuses: Cc:


It used to be (at least to 2.5.1) that something like

get_children(array('post_parent' => 123));

would return the children of 123---all of them.

Now, however, the posts query for the above ends up with the following in the where clause, which is not likely to return any children:

AND wp_posts.post_type = '' AND (wp_posts.post_status = 'publish')

That's because post_type and post_status are not specified by get_children(), so they're set to those defaults. Since children probably have a post_type of "attachment" and status of "inherit", we're not going to be returning any children.

My patch sets the defaults of get_children() to ignore post_status and post_type if not set.

This will not affect any core behavior, because all calls to get_children() in core specify post_status and type.

Attachments (1)

get_children_post_status.diff (453 bytes) - added by filosofo 16 years ago.

Download all attachments as: .zip

Change History (2)

#1 @ryan
16 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10130]) Get all children. Props filosofo. fixes #8527

Note: See TracTickets for help on using tickets.