这是wp_mail($to, $subject, $message, $headers, $attachments);
对这些事情的作用。
此外,还有一个函数get_permalink();
. 还有一个叫get_the_title();
.
您可以将它们组合在一个函数中:
function wpse25552_mail_permalink()
{
global $post;
$post_id = $post->ID;
$title = get_the_title( $post_id );
$subject = sprintf( __(\'I want to share %1$s with you\', YOUR_TEXTDOMAIN ), $title );
$permalink = get_permalink( $post_id );
$message = sprintf( __("Yo! Look what I\'ve found here: %1$s", YOUR_TEXTDOMAIN), $permalink );
// ... stuff for $to, $subject, etc.
wp_mail($to, $subject, $message, $headers, $attachments);
}
请注意,您必须替换
YOUR_TEXTDOMAIN
使用主题文本域字符串。否则你可以省去它(别忘了删除逗号)