Using Gravity Forms ‘gform_paypalpaymentspro_verifyhost’ PHP filter

The gform_paypalpaymentspro_verifyhost Gravity Forms filter allows you to bypass host verification in PayPal Payments Pro integration.

Usage

add_filter('gform_paypalpaymentspro_verifyhost', 'your_function_name', 10, 1);

Parameters

  • $is_enabled (bool): Indicates if the CURLOPT_SSL_VERIFYHOST setting is enabled. True enables host verification, false disables.

More information

See Gravity Forms Docs: gform_paypalpaymentspro_verifyhost

Examples

Disable host verification

add_filter('gform_paypalpaymentspro_verifyhost', 'disable_verification', 10, 1);
function disable_verification($is_enabled) {
    return false;
}

This code disables host verification for PayPal Payments Pro integration. Place this code in your active theme’s functions.php file.

Enable host verification

add_filter('gform_paypalpaymentspro_verifyhost', 'enable_verification', 10, 1);
function enable_verification($is_enabled) {
    return true;
}

This code enables host verification for PayPal Payments Pro integration. Place this code in your active theme’s functions.php file.

Disable host verification for a specific form

add_filter('gform_paypalpaymentspro_verifyhost', 'disable_verification_for_form', 10, 2);
function disable_verification_for_form($is_enabled, $form) {
    if ($form['id'] == 5) {
        return false;
    }
    return $is_enabled;
}

This code disables host verification for a specific form with ID 5. Place this code in your active theme’s functions.php file.

Enable host verification based on form settings

add_filter('gform_paypalpaymentspro_verifyhost', 'enable_verification_based_on_form_settings', 10, 2);
function enable_verification_based_on_form_settings($is_enabled, $form) {
    if (isset($form['enableHostVerification']) && $form['enableHostVerification']) {
        return true;
    }
    return $is_enabled;
}

This code enables host verification if the form has a setting enableHostVerification set to true. Place this code in your active theme’s functions.php file.

Enable host verification for production environment

add_filter('gform_paypalpaymentspro_verifyhost', 'enable_verification_for_production', 10, 1);
function enable_verification_for_production($is_enabled) {
    if (getenv('WP_ENV') == 'production') {
        return true;
    }
    return $is_enabled;
}

This code enables host verification for the production environment. Place this code in your active theme’s functions.php file.