我正在将自定义元添加到我的附件文件中,并希望将每个附件的三个页面 ID 存储在一个数组中。
然后,我想为该数组中存在 ID 的附件执行 get_posts,但该数组返回为空。
$p_downloads = get_posts(array(
'post_type' => 'attachment',
'post_mime_type' => 'application/pdf',
'meta_key' => 'bv_media_meta_procedure',
'meta_value' => $post->ID,
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => -1
));
目前,其中一个附件的 bv_media_meta_procedure 的 post meta 如下所示:
array (size=1)
0 =>
array (size=3)
0 => string '238' (length=3)
1 => string 'null' (length=4)
2 => string 'null' (length=4)
所以在 238 的页面 ID 上,我希望看到在 get_posts 函数中返回的附件。
但是它返回的是空的,怎么会呢?