Ash*_*kar 2 php wordpress contact-form-7
我想在 contactform7 下方或上方显示自定义消息,而不发送电子邮件。我厌倦了使用 before_send_email 函数,但没有任何效果。下面是我使用过的功能。
add_action("wpcf7_before_send_mail", "wpcf7_do_something_else");
function wpcf7_do_something_else($cf7) {
$wpcf->skip_mail = true;
// Here I tried to use jquery or wordpress filter function to display custom message. but nothing is displaying.
return $wpcf;
}
Run Code Online (Sandbox Code Playgroud)
请帮忙
小智 5
要在表单提交上返回自定义消息,您可以使用过滤器wpcf7_ajax_json_echo
尝试一下:
add_filter("wpcf7_ajax_json_echo", function ($response, $result) {
$response["message"] = "a custom message";
return $response;
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7614 次 |
| 最近记录: |