在我的本地中,我可以使用以下代码从帖子中获取附加图片。但在我的实时服务器中,$ images返回一个空数组。本地和现场会有什么区别?我无法从Wordpress中的帖子获取附加图片
$images = get_children(
array(
'post_parent' => $post_id,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image'
)
);
感谢
你确定图像有post_parrent吗? – 2014-09-25 01:45:55
当我将图像添加到帖子时,它们是不是会自动成为该帖子的子项?你添加到文本编辑器(内容)的 – tolga 2014-09-25 01:47:35
?或者你添加post_thumbnail? – 2014-09-25 01:49:53