我制作了一个包含元查询的自定义查询,但有些字段是序列化数组。有没有办法从该数组中获取值?到目前为止我尝试过的所有东西都不起作用。
$query_args = array(
'post_type' => 'yacht',
'_meta_or_tax' => true,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'manufacturers',
'field' => 'id',
'terms' => $_GET['manufacturer']
),
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $_GET['cat'],
)
),
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'yachts_length',
'value' => array($_GET['min_length'], $_GET['max_length']),
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
array(
'key' => 'yachts_price',
'value' => array($_GET['min_price'], $_GET['max_price']),
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
array(
'key' => 'yachts_year',
'value' => array($_GET['min_year'], $_GET['max_year']),
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
array(
'key' => 'yachts_fuel',
'value' => $_GET['fuel'],
'compare' => 'LIKE',
),
array(
'key' => 'yachts_cabins',
'value' => $_GET['cabins'],
'compare' => 'LIKE',
'type' => 'NUMERIC',
),
array(
'key' => 'yachts_engine_type',
'value' => $_GET['engine_type'],
'compare' => 'LIKE',
),
array(
'key' => 'yachts_en',
'value' => $_GET['engines'],
'compare' => 'LIKE',
'type' => 'NUMERIC',
),
array(
'key' => 'yachts_drive',
'value' => $_GET['drive_type'],
'compare' => 'LIKE',
),
)
);
$yacht_query = new WP_Query( $query_args );
yachts_cabins,yachts_fuel,yachts_engine_type,yachts_en,yachts_type是序列化数组。