edd_sl_api_request_verify_ssl
Filters whether SSL verification is performed during Easy Digital Downloads Software Licensing API requests.
add_filter( 'edd_sl_api_request_verify_ssl', $callback, 10, 1 );
Description
Filters whether SSL verification is enabled for Easy Digital Downloads Software Licensing API requests. This allows developers to disable SSL verification for specific scenarios, though this is generally not recommended due to security risks. The filter returns a boolean value and passes the updater object.
Usage
add_filter( 'edd_sl_api_request_verify_ssl', 'your_function_name', 10, 1 );
Parameters
-
$this(mixed) - This parameter is a boolean value indicating whether SSL verification should be performed for the API request.
Return Value
The filtered value.
Examples
/**
* Prevent SSL verification for Easy Digital Downloads Software Licensing API requests.
*
* This function hooks into the 'edd_sl_api_request_verify_ssl' filter and
* returns false, effectively disabling SSL certificate verification for
* API requests made by the EDD Software Licensing updater.
*
* This can be useful in development environments or when dealing with
* self-signed certificates, but should be used with extreme caution in
* production as it bypasses a crucial security measure.
*
* @param bool $verify_ssl Whether to verify SSL certificates.
* @param EDD_SL_Plugin_Updater $updater The EDD_SL_Plugin_Updater instance.
* @return bool False to disable SSL verification.
*/
function my_edd_sl_disable_ssl_verification( $verify_ssl, $updater ) {
// In a real-world scenario, you might want to add conditional logic here.
// For example, only disable SSL verification for specific sites or under certain conditions.
// For this example, we're simply disabling it for all EDD SL API requests.
return false;
}
add_filter( 'edd_sl_api_request_verify_ssl', 'my_edd_sl_disable_ssl_verification', 10, 2 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/includes/EDD_SL_Plugin_Updater.php:703
private function verify_ssl() {
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
}