Last active
June 12, 2017 12:49
-
-
Save vishalck/a85c3781a8d60866e9fba62587cd23e8 to your computer and use it in GitHub Desktop.
Make custom columns sortable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "manage_edit-shop_order_sortable_columns", 'MY_COLUMNS_SORT_FUNCTION' ); | |
function MY_COLUMNS_SORT_FUNCTION( $columns ) | |
{ | |
$custom = array( | |
'MY_COLUMN_ID_1' => 'MY_COLUMN_1_POST_META_ID', | |
'MY_COLUMN_ID_2' => 'MY_COLUMN_2_POST_META_ID' | |
); | |
return wp_parse_args( $custom, $columns ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment