在wp_mail变量中引用Wordpress标头函数

时间:2015-03-09 22:38:29

标签: php wordpress

我试图以Wordpress邮件形式引用网站的标题。我以为我可以回声,但这似乎不起作用。换句话说,我希望邮件表单的主题始终是#34;来自[site title here]"的RSVP。

// variables connect with rsvp form
$name = $_POST["rsvpName"];
$email = $_POST["rsvpEmail"]; 
$attend = $_POST["rsvpAttend"];
$number = $_POST["rsvpNumber"];
$website = '<?php echo bloginfo('name') ?>';

// variables defined for message to admin
$to = get_option('admin_email'); //sending to wordpress admin email
$subject = "RSVP from $website";
$headers = "From: $email";
$message = "$name $attend your invitation.\nNumber of guests in their party:  
$number";

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

您当前的代码正在创建一个包含php标记的字符串。 您需要使用get_bloginfo函数:

$website = get_bloginfo('name');