diff --git wp-includes/query.php wp-includes/query.php
index e249ec2..8d85e3e 100644
|
|
|
class WP_Query { |
| 2733 | 2733 | |
| 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 | | } |
| | 2736 | $stickies = get_posts( array( |
| | 2737 | 'post__in' => $sticky_posts, |
| | 2738 | 'post_type' => $post_type, |
| | 2739 | 'post_status' => 'publish', |
| | 2740 | 'nopaging' => true |
| | 2741 | ) ); |
| 2747 | 2742 | |
| 2748 | | $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in) $stickies_where" ); |
| 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 | } |
| 2756 | 2747 | } |