WordPress.org

Make WordPress Core

Ticket #13729: 13729-FIELD.diff

File 13729-FIELD.diff, 633 bytes (added by markjaquith, 6 years ago)
  • wp-includes/query.php

    class WP_Query { 
    23312331                        $orderby = "$wpdb->posts.post_date " . $q['order'];
    23322332                } elseif ( 'none' == $q['orderby'] ) {
    23332333                        $orderby = '';
     2334                } elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
     2335                        $orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
    23342336                } else {
    23352337                        // Used to filter values
    23362338                        $allowed_keys = array('name', 'author', 'date', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand', 'comment_count');