Ticket #11076: post.php.diff
File post.php.diff, 2.8 KB (added by , 15 years ago) |
---|
-
wp-includes/post.php
987 987 * @param array $args Optional. Overrides defaults. 988 988 * @return array List of posts. 989 989 */ 990 function get_posts($args = null) {990 function get_posts($args = '') { 991 991 $defaults = array( 992 'post_type' => 'post', 'category' => 0, 993 'exclude' => array(), 'include' => array(), 994 'meta_key' => '', 'meta_value' =>'', 995 'orderby' => 'post_date', 'order' => 'DESC', 992 996 'numberposts' => 5, 'offset' => 0, 993 'category' => 0, 'orderby' => 'post_date',994 'order' => 'DESC', 'include' => '',995 'exclude' => '', 'meta_key' => '',996 'meta_value' =>'', 'post_type' => 'post',997 997 'suppress_filters' => true 998 998 ); 999 999 … … 1005 1005 if ( ! empty($r['category']) ) 1006 1006 $r['cat'] = $r['category']; 1007 1007 if ( ! empty($r['include']) ) { 1008 $incposts = preg_split('/[\s,]+/',$r['include']);1008 $incposts = wp_parse_id_list($r['include']); 1009 1009 $r['posts_per_page'] = count($incposts); // only the number of posts included 1010 1010 $r['post__in'] = $incposts; 1011 1011 } elseif ( ! empty($r['exclude']) ) 1012 $r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);1012 $r['post__not_in'] = wp_parse_id_list($r['exclude']); 1013 1013 1014 1014 $r['caller_get_posts'] = true; 1015 1015 … … 2922 2922 $defaults = array( 2923 2923 'child_of' => 0, 'sort_order' => 'ASC', 2924 2924 'sort_column' => 'post_title', 'hierarchical' => 1, 2925 'exclude' => '', 'include' => '',2925 'exclude' => array(), 'include' => array(), 2926 2926 'meta_key' => '', 'meta_value' => '', 2927 2927 'authors' => '', 'parent' => -1, 'exclude_tree' => '', 2928 2928 'number' => '', 'offset' => 0, … … 2963 2963 $meta_key = ''; 2964 2964 $meta_value = ''; 2965 2965 $hierarchical = false; 2966 $incpages = preg_split('/[\s,]+/',$include);2967 if ( count($incpages) ) {2966 $incpages = wp_parse_id_list($include); 2967 if ( !empty($incpages) ) { 2968 2968 foreach ( $incpages as $incpage ) { 2969 2969 if (empty($inclusions)) 2970 2970 $inclusions = $wpdb->prepare(' AND ( ID = %d ', $incpage); … … 2978 2978 2979 2979 $exclusions = ''; 2980 2980 if ( !empty($exclude) ) { 2981 $expages = preg_split('/[\s,]+/',$exclude);2982 if ( count($expages) ) {2981 $expages = wp_parse_id_list($exclude); 2982 if ( !empty($expages) ) { 2983 2983 foreach ( $expages as $expage ) { 2984 2984 if (empty($exclusions)) 2985 2985 $exclusions = $wpdb->prepare(' AND ( ID <> %d ', $expage); … … 2995 2995 if (!empty($authors)) { 2996 2996 $post_authors = preg_split('/[\s,]+/',$authors); 2997 2997 2998 if ( count($post_authors) ) {2998 if ( !empty($post_authors) ) { 2999 2999 foreach ( $post_authors as $post_author ) { 3000 3000 //Do we have an author id or an author login? 3001 3001 if ( 0 == intval($post_author) ) { … … 4583 4583 4584 4584 add_filter('the_preview', '_set_preview'); 4585 4585 } 4586 } 4587 No newline at end of file 4586 } 4587