📜  重力形式重定向打开新选项卡 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:56.479000             🧑  作者: Mango

代码示例1
add_filter( 'gform_confirmation', function ( $confirmation, $form, $entry, $ajax ) {
    GFCommon::log_debug( __METHOD__ . '(): running.' );
 
    $forms = array( 3, 6, 7 ); // Target forms with id 3, 6 and 7. Change this to fit your needs.
 
    if ( ! in_array( $form['id'], $forms, true ) ) {
        return $confirmation;
    }
 
    if ( isset( $confirmation['redirect'] ) ) {
        $url          = esc_url_raw( $confirmation['redirect'] );
        GFCommon::log_debug( __METHOD__ . '(): Redirect to URL: ' . $url );
        $confirmation = 'Thanks for contacting us! We will get in touch with you shortly.';
        $confirmation .= "";
    }
 
    return $confirmation;
}, 10, 4 );