Query custom post type custom meta key

Now i got this code and i works.

function get_events(  ) {

    $recurrence_ids = get_post_custom_values( '_recurrence_id' );
    $recurrence_id = $recurrence_ids[0];

    $the_query_args = array(
        'posts_per_page'   => -1,
        'post_type'        => 'event',
        'meta_key'         => '_recurrence_id',
        'meta_value'       => $recurrence_id
    );
    $the_query = new WP_Query( $the_query_args );
    
    if ( $the_query->have_posts() ) {
    $output="<div class="weitere-termine">";
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
        
        setlocale (LC_TIME, "de_DE.utf8"); 

        $date = get_post_custom_values( '_event_start_date' );
    
        if($date){
            $date =  strftime("%a. %d.%m.%Y", strtotime($date[0])) ;
        }
        
        $output .= '<a href="' . get_the_permalink() . '">';
        $output .= '<span>' . $date . '</span>';
        $output .= '</a>';
    }
    $output .= '</div>';
} else {
    // no posts found
}
/* Restore original Post Data */
wp_reset_postdata();

return $output;
    
}
add_shortcode( 'get_events', 'get_events' );