您需要将meta\\u compare参数添加到元查询中。现在,您的代码如下所示:
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'pb_responsible_home_person\',
\'value\' => $current_player_name,
\'compare\' => \'=\'
),
array(
\'key\' => \'pb_responsible_away_person\',
\'value\' => $current_player_name,
\'compare\' => \'=\'
),
)// meta query end
编辑
$current\\u player\\u name=get\\u post\\u meta(get\\u the\\u ID(),“football\\u team\\u team\\u name”,true);
$m_keys =array(\'pb_responsible_home_person\',\'pb_responsible_away_person\')
$meta_query = array(\'relation\' => \'OR\');
foreach ($m_keys as $m_key) {
$meta_query[] = array(
\'key\' => $m_key,
\'value\' => $current_player_name,
\'compare\' => \'=\'
);
}
$args = array(
\'post_type\' => \'football_fixture\',
\'meta_query\' => $meta_query
);
试试这个,当我在本地检查时工作