Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function bpd_ajax_filter_search_callback() {
- if(isset($_POST['search'])) {
- $searchterm = esc_attr( $_POST['search'] );
- $args = array(
- 'posts_per_page' => -1,
- 'post_status' => 'publish',
- 'post_type' => 'product',
- 's' => $searchterm
- );
- }
- $the_query = new WP_Query($args);
- if($the_query->have_posts()):
- while($the_query->have_posts()):
- $the_query->the_post();
- the_title();
- echo '<br>';
- endwhile;
- wp_reset_query();
- endif;
- die;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement