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. See #25493. See #34825. Built from https://develop.svn.wordpress.org/trunk@35818 git-svn-id: http://core.svn.wordpress.org/trunk@35782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5031ca5c23
commit
3c0c5e6ad5
|
@ -1036,38 +1036,6 @@ class WP_List_Table {
|
||||||
return count( $columns ) - count( $hidden );
|
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.
|
* 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 = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
||||||
$current_url = remove_query_arg( 'paged', $current_url );
|
$current_url = remove_query_arg( 'paged', $current_url );
|
||||||
|
|
||||||
$current_orderby = $this->get_orderby();
|
if ( isset( $_GET['orderby'] ) ) {
|
||||||
$current_order = $this->get_order();
|
$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'] ) ) {
|
if ( ! empty( $columns['cb'] ) ) {
|
||||||
static $cb_counter = 1;
|
static $cb_counter = 1;
|
||||||
|
|
|
@ -1008,16 +1008,12 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
$orderby = $q['orderby'];
|
$orderby = $q['orderby'];
|
||||||
} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
|
} elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
|
||||||
$orderby = 'modified';
|
$orderby = 'modified';
|
||||||
} elseif ( ! is_post_type_hierarchical( $post_type ) ) {
|
|
||||||
$orderby = 'date';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $q['order'] ) ) {
|
if ( isset( $q['order'] ) ) {
|
||||||
$order = $q['order'];
|
$order = $q['order'];
|
||||||
} elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
|
} elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
|
||||||
$order = 'ASC';
|
$order = 'ASC';
|
||||||
} else {
|
|
||||||
$order = 'desc';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$per_page = "edit_{$post_type}_per_page";
|
$per_page = "edit_{$post_type}_per_page";
|
||||||
|
@ -1844,4 +1840,4 @@ function redirect_post($post_id = '') {
|
||||||
*/
|
*/
|
||||||
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
|
wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.5-alpha-35817';
|
$wp_version = '4.5-alpha-35818';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue