Filter
uncanny-automator-pro
https_local_ssl_verify
Filters whether local SSL certificates should be verified when making outgoing HTTPS requests.
add_filter( 'https_local_ssl_verify', $callback, 10, 1 );
Description
Filters the SSL verification setting for local HTTPS requests made by the background processing library. Developers can set this to `true` to enforce SSL verification for local requests if needed, though it's generally safe to leave as `false` for local environments. This filter fires when preparing arguments for an outgoing HTTP request.
Usage
add_filter( 'https_local_ssl_verify', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of using the 'https_local_ssl_verify' filter to disable SSL verification for local requests.
*
* This function is intended to be added to the 'https_local_ssl_verify' filter.
* It returns 'false', which tells WordPress not to verify the SSL certificate
* for local HTTP requests. This can be useful in development environments
* where self-signed certificates or other SSL issues might prevent requests.
*
* @param bool $ssl_verify The current SSL verification setting. Default is false.
* @return bool The modified SSL verification setting.
*/
function my_disable_local_ssl_verification( $ssl_verify ) {
// In a real-world scenario, you might want to add conditions here
// to only disable SSL verification for specific local hosts or under certain conditions.
// For this example, we're simply ensuring it's always false.
return false;
}
add_filter( 'https_local_ssl_verify', 'my_disable_local_ssl_verification', 10, 1 );
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
uncanny-automator-pro/src/core/loops/loop/background-process/lib/wp-background-processing/wp-async-request.php:148
protected function get_post_args() {
if ( property_exists( $this, 'post_args' ) ) {
return $this->post_args;
}
$args = array(
'timeout' => 0.01,
'blocking' => false,
'body' => $this->data,
'cookies' => $_COOKIE, // Passing cookies ensures request is performed as initiating user.
'sslverify' => apply_filters( 'https_local_ssl_verify', false ), // Local requests, fine to pass false.
);
/**
* Filters the post arguments used during an async request.
*
* @param array $args
*/
return apply_filters( $this->identifier . '_post_args', $args );
}