WordPress通过自定义数组字段值获取post过滤器


WordPress get post filter by custom array field value

我有一个自定义字段,它的值是一个wp数组。

和我试图得到这个自定义字段过滤的帖子,问题是值是一个数组和我的代码不工作。

这是最后一次尝试:

$args = array(
            'orderby' => 'title', 
            'post_type' => 'need', 
            'meta_key' =>'institution',
            'meta_value'=>  '.$institutionId.');
        $donations = get_posts($args);

我也试过meta_query,但它也不起作用:(

编辑:

我已经存档了我想要的解决方案。但我现在可以回答我的问题了…所以当我可以的时候我会把答案贴出来

尝试用$institutionId$institutionId[0]代替'.$institutionId.'