Ticket #18120: link-template.diff
| File link-template.diff, 1.4 KB (added by javert03, 23 months ago) |
|---|
-
wp-includes/link-template.php
1130 1130 } 1131 1131 1132 1132 $adjacent = $previous ? 'previous' : 'next'; 1133 $ op = $previous ? '<' : '>';1133 $dateCmp = 'BETWEEN ' . ($previous ? "%s AND '9999-12-31 00:00:00'" : "'1970-01-01 00:00:00' AND %s" ); 1134 1134 $order = $previous ? 'DESC' : 'ASC'; 1135 1135 1136 1136 $join = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories ); 1137 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $ op %sAND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories );1137 $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $dateCmp AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories ); 1138 1138 $sort = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" ); 1139 1139 1140 $query = "SELECT p. *FROM $wpdb->posts AS p $join $where $sort";1140 $query = "SELECT p.ID, p.post_title, p.post_status, p.post_date FROM $wpdb->posts AS p $join $where $sort"; 1141 1141 $query_key = 'adjacent_post_' . md5($query); 1142 1142 $result = wp_cache_get($query_key, 'counts'); 1143 1143 if ( false !== $result )
