0
這是我的函數發送了頭,接收報警信息,在WordPress的功能..警告:不能更改頭信息 - 已經
class emailer {
function notifyHeart($post_ID) {
$interests = get_user_meta(get_current_user_id(), 'interests');
$to = the_author_meta('user_email', get_current_user_id());
$post = get_post($post_ID);
foreach($interests as $interest) {
if(has_tag($interest, $post)) {
$email = $to;
mail($email, "An article about Heart", 'A new post has been published about heart.');
break;
}
}
}
}
add_action('publish_post', array('emailer', 'notifyHeart'));
發佈後門柱的錯誤出現,只有當我包括
發生$to = the_author_meta('user_email', get_current_user_id());
如果我有這個代替,
$to = "[email protected]";
沒有警告發生。想到任何人?
這實際上是拇指與WordPress要記住,因爲它是跨多個函數使用像the_content一個好的規則()和get_the_content()。 – hansvedo
哎呀,謝謝你的提名,絕對會在未來保持在腦海中。 – Richard