我是wordpress的新手,试图使用Contact Form 7插件 . 我想将一个特定的cf7表单提交给外部URL . 我搜索并找到了这些引用并使用它们 .

https://babelscribe.nz/wordpress-3/contact-form-7-change-action-url/ https://wordpress.stackexchange.com/questions/290373/contact-form-7-custom-post-action how to change form action url for contact form 7?

我把它放在我的wp-config中 .

define('WP_DEBUG', false);

然后,我把它放在我的functions.php中

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url() {
    return 'https://myurl.com/index.php';
}

有了这个,我就可以将所有联系表格7提交给myurl .

但是,现在我想更改此设置并根据表单ID将表单提交到URL . 所以,我用它来将ID = 78的联系表格提交给myurl.com

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url(){
    global $wpcf7_contact_form;
    if ($wpcf7_contact_form->id === 78){
        return 'http://myurl.com/index.php';
    }  
}

但是,这没有用 . 当我遵循上述参考文献报道的确切解决方案时,我无法理解为什么会发生这种情况 .

请你帮助我好吗?

提前致谢,