Make WordPress Core


Ignore:
Timestamp:
07/31/2009 09:31:56 AM (17 years ago)
Author:
markjaquith
Message:

Return an empty array instead of false for get_children() when no children found. props Denis-de-Bernardy. fixes #10053

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r11750 r11756  
    115115 */
    116116function &get_children($args = '', $output = OBJECT) {
     117        $kids = array();
    117118        if ( empty( $args ) ) {
    118119                if ( isset( $GLOBALS['post'] ) ) {
    119120                        $args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
    120121                } else {
    121                         return false;
     122                        return $kids;
    122123                }
    123124        } elseif ( is_object( $args ) ) {
     
    135136
    136137        $children = get_posts( $r );
    137         if ( !$children ) {
    138                 $kids = false;
     138       
     139        if ( !$children )
    139140                return $kids;
    140         }
    141141
    142142        update_post_cache($children);
Note: See TracChangeset for help on using the changeset viewer.