The problem was that I can’t get wp_count
of my custom post type. The result was that I got nothing.
I found this solution
$args = array(
'post_type' => 'orders'
);
$count = new WP_Query( $args );
$orders = $count->found_posts +1;
After this I insert my post