Changeset 21585
- Timestamp:
- 08/22/2012 06:24:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/query.php
r21569 r21585 2734 2734 // Fetch sticky posts that weren't in the query results 2735 2735 if ( !empty($sticky_posts) ) { 2736 $stickies__in = implode(',', array_map( 'absint', $sticky_posts )); 2737 // honor post type(s) if not set to any 2738 $stickies_where = ''; 2739 if ( 'any' != $post_type && '' != $post_type ) { 2740 if ( is_array( $post_type ) ) { 2741 $post_types = join( "', '", $post_type ); 2742 } else { 2743 $post_types = $post_type; 2744 } 2745 $stickies_where = "AND $wpdb->posts.post_type IN ('" . $post_types . "')"; 2746 } 2747 2748 $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" ); 2736 $stickies = get_posts( array( 2737 'post__in' => $sticky_posts, 2738 'post_type' => $post_type, 2739 'post_status' => 'publish', 2740 'nopaging' => true 2741 ) ); 2742 2749 2743 foreach ( $stickies as $sticky_post ) { 2750 // Ignore sticky posts the current user cannot read or are not published. 2751 if ( 'publish' != $sticky_post->post_status ) 2752 continue; 2753 array_splice($this->posts, $sticky_offset, 0, array( get_post( $sticky_post ) ) ); 2744 array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) ); 2754 2745 $sticky_offset++; 2755 2746 }
Note: See TracChangeset
for help on using the changeset viewer.