$title ) { $_slug = str_replace('wc-','', $status); $_color = $this->color( $_slug ); $_bgColor = $this->bgColor( $_slug ); wp_insert_post( array( 'post_title' => $title, 'post_name' => $status, 'post_type' => 'wc_order_status', 'post_status' => 'publish', 'meta_input' => array( '_title_status' => $title, '_slug_status' => $_slug, '_order_status_default' => 'yes', '_color_status' => $_color, '_bg_color_status' => $_bgColor, '_order_status_type' => ( 'processing' == $_slug || 'completed' == $_slug ) ? '' : 'is_required_payment', '_report_order_status' => ( 'processing' == $_slug || 'completed' == $_slug || 'on-hold' == $_slug ) ? 'on' : '', ) ) ); } } \flush_rewrite_rules(); } }