I have run into some WordPress code which does POST requests to API sites and in the POST parameters for the SSL property it has
$params = array( 'body' => $_POST, 'sslverify' => apply_filters('https_local_ssl_verify', false));
So why not simply put false or true?
The
apply_filters()
function lets plugins and themes override the value. So yes, you could manually setsslverify
tofalse
. The code snippet you included will set it to false in the absence of any filter.Let’s say I have a plugin that wants to force it to true. I would add this:
The
__return_true()
function is a special function in WordPress that automatically returnstrue
. So if I add this code to a plugin or my theme’sfuntions.php
file, it will force your code above to set'sslverify' => true
.It all depends on your local setup and what you’re trying to do with the site. The use of
apply_filters()
merely makes things as flexible as possible.