请尝试以下方法,我认为从site_url()
函数可能会对$confirm_url
变量
这样,您的url中就有一个未替换的斜杠。
$site_url = site_url();
$confirm_url = $site_url. \'\\/verification?id=\' . $post_id . \'&hash=\' . $hash;
// Send a verification e-mail to the user to confirm publication
$subject = \'Please confirm your Slicer Profile submission\';
$body = $confirm_url;
wp_mail( $profile_email, $subject, $body );
您可能还需要切换到魔术引号,即:
$site_url = site_url();
$confirm_url = "{$site_url}/verification?id={$post_id}&hash={$hash}";
// Send a verification e-mail to the user to confirm publication
$subject = "Please confirm your Slicer Profile submission";
$body = $confirm_url;
wp_mail( $profile_email, $subject, $body );
双引号中变量周围的括号不是必需的,但一些开发人员发现它们更容易在长字符串中读取。