3
我正在向WordPress中動態添加帖子。我使用下面的代碼創建後,並添加一個有特色的圖像,其工作正常,但有2個問題以編程方式爲特色圖片添加帖子
- 它增加了2個職位1圖像本身沒有其他內容無誤,並提供崗位與形象特色形象。
精選圖像張貼大小。
$ post_id = wp_insert_post($ postdata,true);
//從url中保存圖片
$ attachmentId_id = wp_insert_attachment($ attachment,$ fullpathfilename,0);
add_post_meta($ post_id,'_thumbnail_id',$ attachmentId,true);