2015-09-25 55 views
1

我在我的网站上有联系表格。在发送邮件之前,我需要更改一个字段的值。例如name。我试试这样:如何在发送联系表格7之前更改数据?

function contactform7_before_send_mail($cf7) { 
    $cf7->posted_data['your_name'] = 'John Doe'; 
} 

add_action('wpcf7_before_send_mail', 'contactform7_before_send_mail'); 

但在电子邮件中的值是指定的形式。

+0

你已经找到了解决办法了吗? –

回答

1

试试这个:

post.php中

$_POST["your_name"] = "John Doe"); 
    do_shortcode("[cfdb-save-form-post]"); 

form.html

<form class="form-contact" action="post.php" method="post"> 
    <input type="text" name="your_name" /> 
</form>