filter wordpress comment with custom field befor load

Hello everyone and thank you for your help:

How can I filter the comments displayed under a page befor load based on a custom field? For example, if the custom field has a value of a, that comment should be displayed, and if it does not have this value, it should not be displayed.

i use this sample code:

$comments20 = get_comments (array (‘meta_key’=> ‘keytoopurl’, ‘meta_value’=> ‘y’));

The number of comments is very high and I want WordPress to receive only comments with high conditions before receiving comments. I also used the example code below but it does not work:

add_action('pre_get_comments', function ($queryObj) {
            $vars = $queryObj->query_vars;
            $vars['meta_key'] = 'keytoopurl';
            $vars['meta_value'] = 'y';
            $queryObj->query_vars = $vars;

thank you


Nothing is Displaying on my browser after running npm start in react app

A simple asynchronous React message popup utility