There is a site on wordpress with an arbitrary record type method (method) which has 2 minimum parameters ( methodic_age_min ) and maximum ( methodic_age_max ) age added using arbitrary fields advanced custom fields

I want to filter the methods using the range slider - a link to the fidl : those methods in which the value of the slider fits into the interval between the minimum and maximum value - and output them.

I'm trying to do this, but I don’t understand how to affect the result filtering. What am I doing wrong?

Template page

 <div class="container"> <form class="filter" action="" method="get"> <input type="range" name="method_age" min="0" max="100" step="1" oninput="go_filter()" id="r1"> <p id="one">50</p> <button type="submit">Отфильтровать</button> </form> <?php if ($_GET && !empty($_GET)) { methodic_filter(); if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title(); ?></h1> <?php the_content(); ?> <div class="ped_holder"> <?php $the_query = new WP_Query( array ( 'post_type' => 'method', 'posts_per_page' => '-1', ) ); while ( $the_query->have_posts() ) : $the_query->the_post(); ?> ... <?php endwhile; wp_reset_postdata(); ?> <?php endwhile; endif; } ?> </div> 

functions.php

 function methodic_filter() { $args = array(); $args['meta_query'] = array('relation' => 'AND'); global $wp_query; if ($_GET['method_age'] != '') { if ($_GET['method_age'] == '') $_GET['method_age'] = 0; $args['meta_query'][] = array( 'key' => 'methodic_age_min', 'value' => (int)$_GET['method_age'], 'type' => 'numeric', 'compare' => '>=' ); $args['meta_query'][] = array( 'key' => 'methodic_age_max', 'value' => (int)$_GET['method_age'], 'type' => 'numeric', 'compare' => '>=' ); } query_posts(array_merge($args,$wp_query->query)); } 

    0