diff --git a/CRM/Core/Permission/WordPress.php b/CRM/Core/Permission/WordPress.php index 3325d0fc117c..03eeb9be3b0f 100644 --- a/CRM/Core/Permission/WordPress.php +++ b/CRM/Core/Permission/WordPress.php @@ -76,10 +76,8 @@ public function check($str, $userId = NULL) { else { //check the capabilities of Anonymous user) $roleObj = new WP_Roles(); - if ( - $roleObj->get_role('anonymous_user') != NULL && - array_key_exists($str, $roleObj->get_role('anonymous_user')->capabilities) - ) { + $anonObj = $roleObj->get_role('anonymous_user'); + if (!empty($anonObj->capabilities) && array_key_exists($str, $anonObj->capabilities)) { return TRUE; } }