wordpress - 联系表格 7 重定向问题
问题描述
提交后,我的联系表单会重定向到一个 URL,后跟一个不熟悉的代码,例如 #wpcf7-f1258-o1。但我使用 on_sent_ok: "my_redirect();" 在附加标题上。
请帮忙!
解决方案
该on_sent_ok
方法已从联系表 7 中删除。
请参阅:https ://contactform7.com/2017/06/07/on-sent-ok-is-deprecated/
尝试在联系表单所在的页面上使用挂钩:
add_action('wp_head', 'cf7_redirect_script');
function cf7_redirect_script(){
if(is_page('page-slug') { ?> // slug of the page which your contact form is on (can also be an ID)
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
// put the desired redirect URL below
location = 'http://yourdomain.com/thank-you';
}, false );
</script>
<?php }
}
推荐阅读
- amazon-dynamodb - 无效的FilterExpression:表达式包含的运算符太多;运营商数量:301
- node.js - 如何为我的后端创建团队的事件模型?
- laravel - Larvel 8 :- 数组到字符串的转换
- r - 如何选择数据框中的列,并跳过不存在的列 - 使用 data.table 语法
- reactjs - 反应中 MDBInput 的自定义高度
- sql - 从 json 文件创建 Athena 表
- python - 在 Airflow 中从一台服务器到另一台服务器的文件传输
- javascript - 如何使用 Material UI 为 formik 表单添加验证
- tabulator - 当用户离开单元格而不进行任何更改时,不会引发制表符 cellEditCancelled
- c# - 用于消息传递和 saga 持久性的 Azure 服务总线