如中所述ACF documentation, 以下是查找自定义字段“color”值为“red”的所有帖子的方法。
$posts = get_posts(array(
    \'numberposts\'   => -1,
    \'post_type\'     => \'post\',
    \'meta_key\'      => \'color\',
    \'meta_value\'    => \'red\'
));
 但在我的例子中,我需要找到对象post自定义字段的ID具有特定ID的所有post。
我应该如何处理meta_value 作为对象,并以其ID键为目标?
 
                    最合适的回答,由SO网友:Krzysiek Dróżdż 整理而成
                    如果使用Post对象字段类型,则它将作为ID存储在自定义字段中。所以这应该可以做到:
$posts = get_posts(array(
    \'numberposts\'   => -1,
    \'post_type\'     => \'post\',
    \'meta_key\'      => \'<FIELD_NAME>\',
    \'meta_value\'    => <POST_ID>
));
 另外,你应该使用“每页帖子”,而不是“数字帖子”(不推荐使用)。