在我的本地中,我可以使用以下代碼從帖子中獲取附加圖片。但在我的實時服務器中,$ 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