From 41f0bf0bc1b1ece0b882c7c732a667ba55389e6e Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 7 Dec 2015 20:08:26 +0000 Subject: [PATCH] List Tables: Revert [34728] and [35482]. Part of [34728] was already reverted in [35682], but the default values still made it impossible to set a default ordering for custom post types. Merge of [35818] for the 4.4 branch. See #25493. Fixes #34825. Built from https://develop.svn.wordpress.org/branches/4.4@35819 git-svn-id: http://core.svn.wordpress.org/branches/4.4@35783 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-list-table.php | 45 ++++++----------------- wp-admin/includes/post.php | 4 -- wp-includes/version.php | 2 +- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/wp-admin/includes/class-wp-list-table.php b/wp-admin/includes/class-wp-list-table.php index 6467280fb3..3a85f79d02 100644 --- a/wp-admin/includes/class-wp-list-table.php +++ b/wp-admin/includes/class-wp-list-table.php @@ -1036,38 +1036,6 @@ class WP_List_Table { return count( $columns ) - count( $hidden ); } - /** - * If 'orderby' is set, return it. - * - * @access protected - * @since 4.4.0 - * - * @return string The value of 'orderby' or empty string. - */ - protected function get_orderby() { - if ( isset( $_GET['orderby'] ) ) { - return $_GET['orderby']; - } - - return ''; - } - - /** - * If 'order' is 'desc', return it. Else return 'asc'. - * - * @access protected - * @since 4.4.0 - * - * @return string 'desc' or 'asc'. - */ - protected function get_order() { - if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { - return 'desc'; - } - - return 'asc'; - } - /** * Print column headers, accounting for hidden and sortable columns. * @@ -1084,8 +1052,17 @@ class WP_List_Table { $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); $current_url = remove_query_arg( 'paged', $current_url ); - $current_orderby = $this->get_orderby(); - $current_order = $this->get_order(); + if ( isset( $_GET['orderby'] ) ) { + $current_orderby = $_GET['orderby']; + } else { + $current_orderby = ''; + } + + if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) { + $current_order = 'desc'; + } else { + $current_order = 'asc'; + } if ( ! empty( $columns['cb'] ) ) { static $cb_counter = 1; diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 14831080b2..fa3e400e3c 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1008,16 +1008,12 @@ function wp_edit_posts_query( $q = false ) { $orderby = $q['orderby']; } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) { $orderby = 'modified'; - } elseif ( ! is_post_type_hierarchical( $post_type ) ) { - $orderby = 'date'; } if ( isset( $q['order'] ) ) { $order = $q['order']; } elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) { $order = 'ASC'; - } else { - $order = 'desc'; } $per_page = "edit_{$post_type}_per_page"; diff --git a/wp-includes/version.php b/wp-includes/version.php index 27d3d3e9fd..9cf4114e94 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-RC1-35815'; +$wp_version = '4.4-RC1-35819'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.