WordPress在wp_die之后发布帖子

I am trying to check if the tax_input from my $_POST is equal to a string. If it is the same, publish the post, else I want to send a message with a wp_die and don't publish the post.

I can see the wp_die message but when I go back to my posts overview, the post is still published.

Someone who has an idea what i'm doing wrong?

function check_user_post() {

    $terms = get_terms( array(
        'taxonomy' => 'activity_region',
        'hide_empty' => false,
    ) );

    $region_id = array();
    foreach ( $terms as $term ) {

        if( $term->slug == 'antwerpen' ) {
            $region_id[] = $term->term_id;
        }
    }

    $term = get_term_by( 'id', $_POST['tax_input']['activity_region'][1], 'activity_region' );

    if( empty( $term ) ) {

        wp_set_object_terms( $_POST['post_ID'], $region_id, 'activity_region', true );
        return;

    }

    if( $term->slug != 'antwerpen' ) {

        //var_dump( $_POST );
        wp_die( '<p>You can not make activities for this region.</p>', 'Error', array( 'back_link' => true ) );

        return;

    }

}

add_action( 'save_post', 'check_user_post' );

The action save_post is triggered right after the post has been saved. So the post has already been saved and your function is executed after that. See also: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post