And*_*ner 2 wordpress contact-form-7
我在网站上使用联系表 7,需要更改复选框提交的数据。复选框有一个名为“如果您不想接收进一步营销”的标签,请在检查Admins通知电子邮件中发送的值显示复选框标签。所以它看起来像:
如果您不想接受进一步的营销,请在此处打勾: 如果您不想接受进一步的营销,请在此处打勾
我想更改它,以便在检查时发布的值为 No。
我相信我可以使用以下动作钩子来实现这一点,但我不知道如何检查此函数中的复选框是否已被选中并修改其值。
非常感谢任何帮助。
// define the wpcf7_posted_data callback
function action_wpcf7_posted_data( $array ) {
// make action magic happen here...
};
// add the action
add_action( 'wpcf7_posted_data', 'action_wpcf7_posted_data', 10, 1 );
Run Code Online (Sandbox Code Playgroud)
我相信你可以使用:
// define the wpcf7_posted_data callback
function action_wpcf7_posted_data( $array ) {
//'checkbox-name' is the name that you gave the field in the CF7 admin.
$value = $array['checkbox-name'];
if( !empty( $value ) ){
$array['checkbox-name'] = "New Value";
}
return $array;
};
add_filter( 'wpcf7_posted_data', 'action_wpcf7_posted_data', 10, 1 );
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9081 次 |
| 最近记录: |