这是我的功能,
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@email.com";
不会出现警告。有人想吗?