このコードを使用してクエリを実行していますが、結果として常にホームページが返されます。誰かが私を助けてくれることを願っています.
$taxonomies_to_search = array(
'type' => 'Type',
'status' => 'Status',
'location' => 'Location',
'general_status' => 'General Status',
);
$tax_query = array(
'relation' => 'AND',
);
foreach ($taxonomies_to_search as $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 );
お気づきのように、私は翻訳に WPML を使用しています。
ありがとう