Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vishalck/a85c3781a8d60866e9fba62587cd23e8 to your computer and use it in GitHub Desktop.
Save vishalck/a85c3781a8d60866e9fba62587cd23e8 to your computer and use it in GitHub Desktop.
Make custom columns sortable
<?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