我不确定您是否已将此函数连接到适当的操作。此外,您还没有正确连接字符串:
而不是$newdestinationurl = $url/$destinationurlslug ;
应该是这样的$newdestinationurl = $url."/".$destinationurlslug ;
完整代码请参见以下内容:
function ninja_forms_handler() {
add_action ( \'ninja_forms_post_process\', \'change_ninja_forms_landing_page\', 1, 2 );
}
add_action(\'init\', \'ninja_forms_handler\');
function change_ninja_forms_landing_page(){
global $ninja_forms_processing;
$form_id = $ninja_forms_processing->get_form_ID();
if( $form_id == 1 ){
$destinationurlslug = $ninja_forms_processing->get_field_value( 1 );
$url = "http://www.blablabla.com";
$newdestinationurl = $url."/".$destinationurlslug ;
/* $url now contains our new redirection page. Let\'s update the form setting. */
$ninja_forms_processing->update_form_setting( \'landing_page\', $newdestinationurl );
}
}
如果使用此方法,请确保未创建实际的重定向通知,否则它将优先。
So simply deactivate the "Success Message" from "Emails & Actions" tab for your form.