添加Post Meta从Array()添加2个条目而不是1个

I am trying to collect the values of all rows from a repeater field for use in a query. I know I need to collect the values and combine them in my own meta_key as ACF saves them in a way that makes it impossible otherwise.

Currently I cannot get it to save the post_meta.

Update

I have modified the code in a way I think should be in the right direction, however now I get 2 items added to the postmeta table instead of 1 item with the values combined inside it.

Functions File

add_filter('acf/save_post', 'update_display_pages', 20);
function update_display_pages($post_id) {
    if ( get_post_type($post_id) != 'popup' )
        return;

    if( have_rows('popup_pages', $post_id) ):
        $displayPages = array();

        while ( have_rows('popup_pages', $post_id) ) : the_row();
             if (get_sub_field('popup_pages_select')) {

                $pages = array();
                $pages[] = get_sub_field('popup_pages_select');

                print_r($pages);
                print_r($displayPages);

                foreach ($pages as $page) {
                    $displayPages = $pages;
                    $displayPages[] = $displayPages;
                }

                if ( get_post_meta( $post_id, 'popup_display_pages', true ) )
                    update_post_meta($post_id, 'popup_display_pages', $displayPages);
                else
                    add_post_meta( $post_id, 'popup_display_pages', $displayPages);
             }
      endwhile;
    endif;
}

Saves As

Meta Key: popup_display_pages
Meta Value: a:2:{i:0;s:33:"https://www.yourdomain.co.uk/page";i:1;a:1:{i:0;s:33:"https://www.yourdomain.co.uk/page";}}

Meta Key: popup_display_pages
Meta Value: a:2:{i:0;s:34:"https://www.yourdomain.co.uk/pager";i:1;a:1:{i:0;s:34:"https://www.yourdomain.co.uk/pager";}}

I want it to save it in 1 Meta Key and store both values however as you can see it just duplicates the first value and then creates another entry and does the same for the other value.