您的语法在一些地方有点不正确。我将尝试让代码解释:
function wpse_199498_meta_to_table( $post_id, $post ) {
    // Use the second argument of our hook, which is the post object
    if ( $post->post_type !== \'festival-event\' )
        return;
    global $wpdb;
    // Don\'t need to use $_POST, just use the functions as documented
    $custom_lat = get_geocode_lat( $post_id );
    $custom_lng = get_geocode_lng( $post_id );
    $check_link = $wpdb->get_var(
        $wpdb->prepare(
            "SELECT post_id FROM lat_lng_post WHERE post_id = %d", // Here\'s that missing comma!
            $post_id
        )
    );
    if ( $check_link ) {
        $wpdb->update(
            \'lang_lng_post\',
            array(   
                \'lat\' => $custom_lat,
                \'lng\' => $custom_lng,
            ),   
            array(
                \'post_id\' => $post_id,
            ),   
            array(   
                \'%f\',  
                \'%f\',
            ),
            \'%d\'
        );
    } else {
        $wpdb->insert(
            \'lang_lng_post\',
            array(   
                \'post_id\' => $post_id,
                \'lat\'     => $custom_lat,
                \'lng\'     => $custom_lng,
            ),   
            array(  
                \'%d\',
                \'%f\',  
                \'%f\',
            )
        );
    }
}
add_action(
    \'wp_insert_post\',            // Later than "save_post", will ensure plugin has already saved meta at this point
    \'wpse_199498_meta_to_table\',
    10,                          // Default priority
    2                            // Number of arguments
);