[英]Contact form 7 send data and redirect to other domain page in wordpress
我在wordpress上有多个Contact表单7,并且我希望一种表单将发送的数据发送到其他域页面进行重定向。 我在functions.php中添加了以下代码以重定向我的特定联系表,数据已成功发送,但页面未重定向。
add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url($url)
{
global $post;
$id_to_change = 5240;
if($wpcf7_contact_form->ID === $id_to_change)
return 'http://34.209.247.91:8069/page/register';
else
return $url;
}
以下是一个脚本示例,该脚本在发生wpcf7mailsent事件时将您重定向到另一个URL。
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
location = 'http://example.com/';
}, false );
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.