wp_query with types checkboxes
-
Hello
I try to make a wp_query with types checkboxes in an ajax request by doing this
on the front I load the checkboxes in a form :
function get_cb(){ $output = ""; $cb = get_option('wpcf-fields'); $unz = $sptes['my_checkboxes']['data']['options']; foreach($unz as $k => $v1) { if (isset($v1['title'])) { $output .= "<input name='my_cbs' type='checkboxes' value='".$v1['set_value']."'>".$v1['title']; } } echo json_encode($output); die; }Once the form is submitted, I want to compare selected checkboxes with database :
function compare(){ $checkboxes= $_REQUEST['my_cbs']; $output = "<h2>Résults :</h2>"; $args = array( 'post_type' => 'my_custom_post_type', 'posts_per_page' =>10, 'meta_query' => array( 'relation' => 'AND' ) ); $args['meta_query'][] = array('key' => 'wpcf-my_checkboxes' , 'value' => $equipements, 'compare' => 'IN'); $query = new WP_Query( $args ); }So it does’nt work. someone could guide me ?
Thanks a lot
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
The topic ‘wp_query with types checkboxes’ is closed to new replies.