file: wp-admin/includes/class-wp-list-table.php
|
|
|
838 | 838 | } |
839 | 839 | |
840 | 840 | /** |
841 | | * Get a list of sortable columns. The format is: |
842 | | * 'internal-name' => 'orderby' |
843 | | * or |
844 | | * 'internal-name' => array( 'orderby', true ) |
| 841 | * Get a list of sortable columns. |
845 | 842 | * |
846 | | * The second format will make the initial sorting order be descending |
| 843 | * The format is: |
| 844 | * - `'internal-name' => 'orderby'` |
| 845 | * - `'internal-name' => array( 'orderby', 'asc' )` - The second element set the initial sorting order. |
| 846 | * - `'internal-name' => array( 'orderby', true )` - The second element will make the initial sorting order be descending. |
847 | 847 | * |
848 | 848 | * @since 3.1.0 |
849 | 849 | * |
… |
… |
|
1052 | 1052 | $class[] = 'sorted'; |
1053 | 1053 | $class[] = $current_order; |
1054 | 1054 | } else { |
1055 | | $order = $desc_first ? 'desc' : 'asc'; |
| 1055 | if( in_array( strtolower($desc_first), array('desc', 'asc'), true ) ) |
| 1056 | $order = strtolower( $desc_first ); |
| 1057 | else |
| 1058 | $order = $desc_first ? 'desc' : 'asc'; |
| 1059 | |
1056 | 1060 | $class[] = 'sortable'; |
1057 | | $class[] = $desc_first ? 'asc' : 'desc'; |
| 1061 | $class[] = $order === 'desc' ? 'asc' : 'desc'; |
1058 | 1062 | } |
1059 | 1063 | |
1060 | 1064 | $column_display_name = '<a href="' . esc_url( add_query_arg( compact( 'orderby', 'order' ), $current_url ) ) . '"><span>' . $column_display_name . '</span><span class="sorting-indicator"></span></a>'; |