Make WordPress Core

Changeset 35819


Ignore:
Timestamp:
12/07/2015 08:07:20 PM (11 years ago)
Author:
ocean90
Message:

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.

Location:
branches/4.4/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.4/src/wp-admin/includes/class-wp-list-table.php

    r35698 r35819  
    10381038
    10391039        /**
    1040          * If 'orderby' is set, return it.
    1041          *
    1042          * @access protected
    1043          * @since 4.4.0
    1044          *
    1045          * @return string The value of 'orderby' or empty string.
    1046          */
    1047         protected function get_orderby() {
    1048                 if ( isset( $_GET['orderby'] ) ) {
    1049                         return $_GET['orderby'];
    1050                 }
    1051 
    1052                 return '';
    1053         }
    1054 
    1055         /**
    1056          * If 'order' is 'desc', return it. Else return 'asc'.
    1057          *
    1058          * @access protected
    1059          * @since 4.4.0
    1060          *
    1061          * @return string 'desc' or 'asc'.
    1062          */
    1063         protected function get_order() {
    1064                 if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
    1065                         return 'desc';
    1066                 }
    1067 
    1068                 return 'asc';
    1069         }
    1070 
    1071         /**
    10721040         * Print column headers, accounting for hidden and sortable columns.
    10731041         *
     
    10851053                $current_url = remove_query_arg( 'paged', $current_url );
    10861054
    1087                 $current_orderby = $this->get_orderby();
    1088                 $current_order = $this->get_order();
     1055                if ( isset( $_GET['orderby'] ) ) {
     1056                        $current_orderby = $_GET['orderby'];
     1057                } else {
     1058                        $current_orderby = '';
     1059                }
     1060
     1061                if ( isset( $_GET['order'] ) && 'desc' === $_GET['order'] ) {
     1062                        $current_order = 'desc';
     1063                } else {
     1064                        $current_order = 'asc';
     1065                }
    10891066
    10901067                if ( ! empty( $columns['cb'] ) ) {
  • branches/4.4/src/wp-admin/includes/post.php

    r35567 r35819  
    10091009        } elseif ( isset( $q['post_status'] ) && in_array( $q['post_status'], array( 'pending', 'draft' ) ) ) {
    10101010                $orderby = 'modified';
    1011         } elseif ( ! is_post_type_hierarchical( $post_type ) ) {
    1012                 $orderby = 'date';
    10131011        }
    10141012
     
    10171015        } elseif ( isset( $q['post_status'] ) && 'pending' == $q['post_status'] ) {
    10181016                $order = 'ASC';
    1019         } else {
    1020                 $order = 'desc';
    10211017        }
    10221018
Note: See TracChangeset for help on using the changeset viewer.