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
This commit is contained in:
Dominik Schilling 2015-12-07 20:08:26 +00:00
parent 2a9083b97e
commit 41f0bf0bc1
3 changed files with 12 additions and 39 deletions

View File

@ -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;

View File

@ -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";

View File

@ -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.