wpml - wordpress: WP_QUERY return the homepage as a result -
i'm using code query, returns home page result, hope can me it.
$taxonomies_to_search = array( 'type' => 'type', 'status' => 'status', 'location' => 'location', 'general_status' => 'general status', ); $tax_query = array( 'relation' => 'and', ); foreach ($taxonomies_to_search $t => $l) { $var_name = 'dp_'. $t; $entradas_term_obj = get_term_by( 'slug', utf8_encode($_get[$var_name]), $t); if(isset($_get[$var_name])){ if ($_get[$var_name] != "0") { $tax_query[] = array( 'taxonomy' => $t, 'field' => 'id', 'terms' => icl_object_id($entradas_term_obj->term_id, $t, true) ); } } } $search_values = array( 'post_type' => 'machines', 'tax_query' => $tax_query, 'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1, 'showposts' => 999, ); $mode = 'search'; global $wp_query; $existing_query_obj = $wp_query; $wp_query = new wp_query( $search_values );
as can notice use wpml translation.
thanks
Comments
Post a Comment