Ticket #12945: 12945-4.diff
File 12945-4.diff, 2.0 KB (added by , 15 years ago) |
---|
-
wp-includes/post-template.php
821 821 * @param array|string $args 822 822 */ 823 823 function wp_page_menu( $args = array() ) { 824 $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '' );824 $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '', 'exclude' => implode( ',', get_pages( array('fields' => 'id') ) ) ); 825 825 $args = wp_parse_args( $args, $defaults ); 826 826 $args = apply_filters( 'wp_page_menu_args', $args ); 827 827 -
wp-includes/post.php
2951 2951 'meta_key' => '', 'meta_value' => '', 2952 2952 'authors' => '', 'parent' => -1, 'exclude_tree' => '', 2953 2953 'number' => '', 'offset' => 0, 2954 'post_type' => 'page', 'post_status' => 'publish', 2954 'post_type' => 'page', 'post_status' => 'publish', 'fields' => 'all' 2955 2955 ); 2956 2956 2957 2957 $r = wp_parse_args( $args, $defaults ); … … 3062 3062 3063 3063 $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status ); 3064 3064 3065 $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where "; 3065 $field = ( $fields == 'all' ) ? '*' : 'ID'; 3066 $query = "SELECT $field FROM $wpdb->posts $join WHERE ($where_post_type) $where "; 3067 3066 3068 $query .= $author_query; 3067 3069 $query .= " ORDER BY " . $sort_column . " " . $sort_order ; 3068 3070 3069 3071 if ( !empty($number) ) 3070 3072 $query .= ' LIMIT ' . $offset . ',' . $number; 3071 3073 3072 $pages = $wpdb->get_results($query); 3073 3074 if( $fields == 'all' ) 3075 $pages = $wpdb->get_results( $query ); 3076 else 3077 $pages = $wpdb->get_col( $query ); 3078 3074 3079 if ( empty($pages) ) { 3075 3080 $pages = apply_filters('get_pages', array(), $r); 3076 3081 return $pages;