I'm creating "Priority Order" will immediately add _priority_list
a named priority list when the company changes status to "Priority Order" Number based on how many orders priority orders are placed, This is the code I am using
function filter_priority_orders() {
global $pagenow;
$qv = &$query->query_vars;
if ( $pagenow == 'edit.php' && isset($qv['post_status']) && $qv['post_status'] == 'wc-priority-order' ) {
$query->set('meta_key', '_priority_list');
$query->set('order_by', '_priority_list');
}
return $query;
}
add_filter( 'pre_get_posts', 'filter_priority_orders' );