0
發佈帖子時,我想附上圖片標識。我使用下面的代碼: -發佈帖子時附上圖片標識
function my_function($post_id){
echo $imgId = get_post_thumbnail_id($post_id); die;
return $post_id;
}
add_filter('publish_post', 'my_function');
它不給圖片ID。 當我編輯並保存現有的帖子時,它會返回圖片ID。
請幫忙.......
你想獲得功能圖像ID? – anstrangel0ver 2013-04-11 05:57:05
@ anstrangel0ver yea ... – user2131144 2013-04-11 06:14:58
嘗試使用'global $ post'和'$ post-> id' – SMacFadyen 2013-04-11 07:19:09