我想选择portata
按类别和其他自定义字段过滤的自定义字段“”的不同值。
这是按类别选择自定义值的查询:
global $wpdb;
$querystr2 = "
SELECT DISTINCT wpostmeta.meta_value
FROM $wpdb->posts wposts
LEFT JOIN $wpdb->postmeta wpostmeta ON wposts.ID = wpostmeta.post_id
LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)
LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
WHERE wpostmeta.meta_key = 'portata'
AND $wpdb->term_taxonomy.taxonomy = 'category'
AND $wpdb->term_taxonomy.term_id IN($variabile_c)
ORDER BY wpostmeta.meta_value ASC
";
如何将其他自定义字段添加到过滤器?