public function search_the_posts($s, $post_type) { $args = array('s' => $s, 'post_type' => $post_type); $q = WP_Query($args); return $q; }
function my_ajax_callback_function() { // Implement ajax function here if ($_GET['first']) { $first = $_GET['first']; } if ($_GET['second']) { $second = $_GET['second']; } $args = array('posts_per_page' => -1, 'post_type' => 'product', 'meta_query' => array(array('key' => '_regular_price', 'value' => array($first, $second), 'compare' => 'BETWEEN', 'type' => 'DECIMAL'))); WP_Query($args); }