The order status you register with wc-custom-order-status is too long - 22 . This only saves the first 20 characters of the message status, which makes it invalid and causes a problem.
Order statuses are recorded as message statuses, and message statuses are limited to 20 characters.
I suggest that you update your wc-custom-order-status name to wc-shipping-progress , which exactly matches 20 characters.
I am also posting an updated version of your code, for reference only (I just changed the status name):
// Register New Order Statuses function wpex_wc_register_post_statuses() { register_post_status( 'wc-shipping-progress', array( 'label' => _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' ), 'public' => true, 'exclude_from_search' => false, 'show_in_admin_all_list' => true, 'show_in_admin_status_list' => true, 'label_count' => _n_noop( 'Approved (%s)', 'Approved (%s)', 'text_domain' ) ) ); } add_filter( 'init', 'wpex_wc_register_post_statuses' ); // Add New Order Statuses to WooCommerce function wpex_wc_add_order_statuses( $order_statuses ) { $order_statuses['wc-shipping-progress'] = _x( 'Shipping In Progress', 'WooCommerce Order status', 'text_domain' ); return $order_statuses; } add_filter( 'wc_order_statuses', 'wpex_wc_add_order_statuses' );
Marin atanasov
source share