From 81e0fe00eee115118af2627543ce9b987b0b10be Mon Sep 17 00:00:00 2001 From: markjaquith Date: Fri, 31 Jul 2009 09:31:56 +0000 Subject: [PATCH] Return an empty array instead of false for get_children() when no children found. props Denis-de-Bernardy. fixes #10053 git-svn-id: http://svn.automattic.com/wordpress/trunk@11756 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 0d87cb1320..471c5df876 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -114,11 +114,12 @@ function update_attached_file( $attachment_id, $file ) { * @return array|bool False on failure and the type will be determined by $output parameter. */ function &get_children($args = '', $output = OBJECT) { + $kids = array(); if ( empty( $args ) ) { if ( isset( $GLOBALS['post'] ) ) { $args = array('post_parent' => (int) $GLOBALS['post']->post_parent ); } else { - return false; + return $kids; } } elseif ( is_object( $args ) ) { $args = array('post_parent' => (int) $args->post_parent ); @@ -134,10 +135,9 @@ function &get_children($args = '', $output = OBJECT) { $r = wp_parse_args( $args, $defaults ); $children = get_posts( $r ); - if ( !$children ) { - $kids = false; + + if ( !$children ) return $kids; - } update_post_cache($children);