0
我在獲取多個值和單個元鍵的結果時真的面臨如此多的問題。例如: 我有10個'蛋'字的帖子。 我有5個'黃油'字的帖子。WP_使用Meta鍵查詢多個值?
現在我正在使用下面的查詢來獲取結果。它假設在結果中顯示15個帖子,但它沒有顯示總體結果。
$args = array(
'numberposts' => -1,
'post_type' => 'recipes',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'ingredients_repeat_%_name',
'compare' => 'LIKE',
'value' => 'Butter',
),
array(
'key' => 'ingredients_repeat_%_name',
'compare' => 'LIKE',
'value' => 'Egg',
),
)
);
我不知道我怎麼會這麼愚蠢。結果很好。只有post_per_page未顯示完整結果。謝謝 –