Using Gravity Forms ‘gform_paypal_sslverify’ PHP filter

The gform_paypal_sslverify filter in Gravity Forms allows the sslverify setting to be modified before sending requests to PayPal.

Usage

add_filter('gform_paypal_sslverify', 'your_function_name');

Parameters

  • $sslverify (bool): Whether to verify SSL for the request.

More information

See Gravity Forms Docs: gform_paypal_sslverify

Examples

Turn off SSL verification

This code allows the request to be completed without SSL verification.

add_filter('gform_paypal_sslverify', '__return_false');

Turn on SSL verification

This code forces SSL verification for the request.

add_filter('gform_paypal_sslverify', '__return_true');

Enable SSL verification based on environment

This code enables SSL verification only for production environments.

function enable_ssl_verification_based_on_env($sslverify) {
    if (defined('WP_ENV') && WP_ENV === 'production') {
        return true;
    }
    return false;
}
add_filter('gform_paypal_sslverify', 'enable_ssl_verification_based_on_env');

Disable SSL verification for specific forms

This code disables SSL verification only for form ID 5.

function disable_ssl_for_specific_form($sslverify, $form) {
    if ($form['id'] == 5) {
        return false;
    }
    return $sslverify;
}
add_filter('gform_paypal_sslverify', 'disable_ssl_for_specific_form', 10, 2);

Enable SSL verification for specific forms

This code enables SSL verification only for form ID 3.

function enable_ssl_for_specific_form($sslverify, $form) {
    if ($form['id'] == 3) {
        return true;
    }
    return $sslverify;
}
add_filter('gform_paypal_sslverify', 'enable_ssl_for_specific_form', 10, 2);