Try adding the following code to your theme’s functions.php file:
/**
* Filter Force Login to allow exceptions for specific URLs.
*
* @return array An array of URLs. Must be absolute.
**/
function my_forcelogin_whitelist() {
return array(
site_url( '/xmlrpc.php' )
);
}
add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
Hi Kevin,
Thanks for the reply, this was the first thing I added but no joy.
Ok, try this instead:
/**
* Filter Force Login to allow exceptions for specific URLs.
*
* @return array An array of URLs. Must be absolute.
**/
function my_forcelogin_whitelist() {
// list of single page URLs
$my_whitelist = array(
site_url( '/xmlrpc.php' )
);
// add any page URL within a directory to my whitelist
if( in_array('jetpack', explode('/', $_SERVER['REQUEST_URI'])) ) {
$my_whitelist[] = site_url($_SERVER['REQUEST_URI']);
}
return $my_whitelist;
}
add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1);
Or you could try this instead:
/**
* Filter Force Login to allow exceptions for specific URLs.
*
* @return array An array of URLs. Must be absolute.
**/
function my_forcelogin_whitelist() {
// list of single page URLs
$my_whitelist = array(
site_url( '/xmlrpc.php' )
);
// add any page URL within a directory to my whitelist
if($_SERVER['REMOTE_ADDR'] == '127.0.0.1') {
$my_whitelist[] = site_url($_SERVER['REQUEST_URI']);
}
return $my_whitelist;
}
add_filter('v_forcelogin_whitelist', 'my_forcelogin_whitelist', 10, 1)
Hi Kevin,
I tried both with no joy.
Just to confirm I am adding this code to my themes functions.php file?
Thanks,
Steve.
Yes, you should be adding this code to your theme’s functions.php file.
Let me know if you figure out how to whitelist the Jetpack plugin.
I just released a new version (4.0) that might address this issue. Let me know if the problem still exists. Thanks!