Make WordPress Core


Ignore:
Timestamp:
10/14/2008 12:15:59 AM (17 years ago)
Author:
ryan
Message:

Add parent arg to get_pages(). Props DD32. fixes #7247

File:
1 edited

Legend:

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

    r9129 r9145  
    20522052        'exclude' => '', 'include' => '',
    20532053        'meta_key' => '', 'meta_value' => '',
    2054         'authors' => ''
     2054        'authors' => '', 'parent' => -1
    20552055    );
    20562056
     
    20652065    $inclusions = '';
    20662066    if ( !empty($include) ) {
    2067         $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
     2067        $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
     2068        $parent = -1;
    20682069        $exclude = '';
    20692070        $meta_key = '';
     
    21382139
    21392140    }
     2141   
     2142    if ( $parent >= 0 )
     2143        $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
     2144   
    21402145    $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
    21412146    $query .= $author_query;
Note: See TracChangeset for help on using the changeset viewer.