Ticket #12600: get_pages.diff
File get_pages.diff, 1.4 KB (added by , 15 years ago) |
---|
-
post.php
2902 2902 'exclude' => '', 'include' => '', 2903 2903 'meta_key' => '', 'meta_value' => '', 2904 2904 'authors' => '', 'parent' => -1, 'exclude_tree' => '', 2905 'number' => '', 'offset' => 0 2905 'number' => '', 'offset' => 0, 2906 'post_type' => 'page', 'post_status' => 'publish', 2906 2907 ); 2907 2908 2908 2909 $r = wp_parse_args( $args, $defaults ); 2909 2910 extract( $r, EXTR_SKIP ); 2910 2911 $number = (int) $number; 2911 2912 $offset = (int) $offset; 2913 2914 // Make sure the post type is hierarchical 2915 $hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) ); 2916 if ( !in_array( $post_type, $hierarchical_post_types ) ) 2917 return false; 2918 2919 // Make sure we have a valid post status 2920 if ( !in_array($post_status, get_post_stati()) ) 2921 return false; 2912 2922 2913 2923 $cache = array(); 2914 2924 $key = md5( serialize( compact(array_keys($defaults)) ) ); … … 3001 3011 3002 3012 if ( $parent >= 0 ) 3003 3013 $where .= $wpdb->prepare(' AND post_parent = %d ', $parent); 3014 3015 $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status ); 3004 3016 3005 $query = "SELECT * FROM $wpdb->posts $join WHERE ( post_type = 'page' AND post_status = 'publish') $where ";3017 $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; 3006 3018 $query .= $author_query; 3007 3019 $query .= " ORDER BY " . $sort_column . " " . $sort_order ; 3008 3020