Make WordPress Core


Ignore:
Timestamp:
12/07/2015 08:07:20 PM (9 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.

File:
1 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'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.