wordpress插入帖在边缘不起作用

I create a code to save data from Form to custom_post_type. Everything ok on Firefox but when I test it on edge, the post still save, but I can't edit the post on admin, or view the post(object not found) (see the image)

enter image description here

I really don't know where is the problem, please help.

this is my code, i copy it from my function.php:

    function wpshout_frontend_post() {
     wpshout_save_post_if_submitted();
    ?>
    <div>
        <div>
            RESERVATION
        </div>      
            <form id="new_post" class = 'datcho' name="new_post" method="post">
            <input type = 'text' name = 'ten' required>
            <input type = 'tel' name = 'sdt' required>
            <input type = 'number' name = 'num' min='1' max = '10' required>
            <input type = 'date' name = 'ngay' required>
            <input type = 'time' name = 'time' value = '13:00' min='9:00' max='21:00' required>
            <?php wp_nonce_field( 'wps-frontend-post' ); ?>


            <input type="submit" value="Reservation" id="submit" name="submit"/>

            </div>
            </form>
    </div>
    <?php
}

function wpshout_save_post_if_submitted() {
    // Stop running function if form wasn't submitted
    if ( !isset($_POST['ten']) ) {
        return; 
    }
    // Check that the nonce was set and valid
    if( !wp_verify_nonce($_POST['_wpnonce'], 'wps-frontend-post') ) {
        echo 'Did not save because your form seemed to be invalid. Sorry';
        return;
    }

    // Do some minor form validation to make sure there is content

    // Add the content of the form to $post as an array
    $title = wp_strip_all_tags($_POST['ten']);
    $post = array(
        'post_title'    => $title,
        'post_content'  => $title,
        'post_status'   => 'Pending',   
        'post_type'     => 'datcho' 
    );

   $eror = wp_insert_post($post,true);
    if($eror){
        $sdt = wp_strip_all_tags($_POST['sdt']);
        $ngay = wp_strip_all_tags($_POST['ngay']);
        $time = wp_strip_all_tags($_POST['time']);
        $num = wp_strip_all_tags($_POST['num']);
        add_post_meta($eror, 'sdt', $sdt);
        add_post_meta($eror, 'ngay', $ngay);
        add_post_meta($eror, 'time', $time);
        add_post_meta($eror, 'num', $num);
        echo 'Saved your post successfully! :)';
    }else {
        echo "something wrong";
    }
}

Here is the complete solution. The issue mainly is you are not logged into the WP in Edge so when creating the post using wp_insert_post wordpress has no idea with which account should it attach that post.

    function wpshout_frontend_post() {
     wpshout_save_post_if_submitted();
    ?>
    <div>
        <div>
            RESERVATION
        </div>      
            <form id="new_post" class = 'datcho' name="new_post" method="post">
            <input type = 'text' name = 'ten' required>
            <input type = 'tel' name = 'sdt' required>
            <input type = 'number' name = 'num' min='1' max = '10' required>
            <input type = 'date' name = 'ngay' required>
            <input type = 'time' name = 'time' value = '13:00' min='9:00' max='21:00' required>
            <?php wp_nonce_field( 'wps-frontend-post' ); ?>


            <input type="submit" value="Reservation" id="submit" name="submit"/>

            </form>
    </div>
    <?php
}

function wpshout_save_post_if_submitted() {
    // Stop running function if form wasn't submitted
    if ( !isset($_POST['ten']) ) {
        return; 
    }
    // Check that the nonce was set and valid
    if( !wp_verify_nonce($_POST['_wpnonce'], 'wps-frontend-post') ) {
        echo 'Did not save because your form seemed to be invalid. Sorry';
        return;
    }

    // Do some minor form validation to make sure there is content

    // Add the content of the form to $post as an array
    $title = wp_strip_all_tags($_POST['ten']);
    $author_id = 1; // You can change it with your User ID
    $post = array(
        'post_title'    => $title,
        'post_content'  => $title,
        'post_status'   => 'draft',   
        'post_type'     => 'datcho'
        'post_author'     => $author_id 
    );

   $eror = wp_insert_post($post,true);
    if($eror){
        $sdt = wp_strip_all_tags($_POST['sdt']);
        $ngay = wp_strip_all_tags($_POST['ngay']);
        $time = wp_strip_all_tags($_POST['time']);
        $num = wp_strip_all_tags($_POST['num']);
        add_post_meta($eror, 'sdt', $sdt);
        add_post_meta($eror, 'ngay', $ngay);
        add_post_meta($eror, 'time', $time);
        add_post_meta($eror, 'num', $num);
        echo 'Saved your post successfully! :)';
    }else {
        echo "something wrong";
    }
}