CF7 Flamingo 从特定表单获取消息

CF7 Flamingo get messages from specific form

我怎样才能从某个表单中获取消息?

有了这个我可以得到所有的入站消息:

<?php
        
    $args = array(
            'post_type' => 'flamingo_inbound',
            'post_status' => 'publish'
    );
    
    $query = new WP_Query($args);
    
    if( $query->have_posts() ){
        while( $query->have_posts() ){
            $query->the_post();
            
            echo '<article>';
            echo get_the_title();
            echo '</article>';
        }
    }
    wp_reset_postdata();

?>

但我只想显示当月来自特定表单的消息。我在 Google 和此处搜索,但找不到任何示例或任何相关内容,所以我希望有人知道。

我已经做了一个解决方案,也许不是最好的 php 但它有效:

<?php
    $currentmonth = date('m');

    $args = array(
            'post_type' => 'flamingo_inbound',
            'post_status' => 'publish',
            'monthnum' => $currentmonth
    );


    $query = new WP_Query($args);

    if( $query->have_posts() ){
        echo '<ul>';
        while( $query->have_posts() ){
            $query->the_post();
            
            $results = get_post_meta( get_the_ID() );

            foreach($results['_meta'] as $result) {
            
                $normaldata = unserialize($result);
                
                if ($normaldata['post_id'] == '1234') { // The id of the post where the form is send from
                    $title = get_the_title();
                    echo '<li>' . $title . '</li>';
                } else {
                  
                }
            }
        }
        echo '</ul>';
    }
    wp_reset_postdata();

?>