Upon dumping the \WP_User
object, I've noticed that there are two properties, which are directly related to capabilities for a particular user.
$user_object->caps
$user_object->allcaps
I've instantly noticed that there's less array values for $user_object->caps
than there are in $user_object->allcaps
. Likely hence the naming convention here.
I currently only observe ONE value under $user_object->caps
. I also have a custom role assigned to this user. The one value in $user_object->caps
happens to be the name of my custom user role. However, that very same value is also listed in $user_object->allcaps
.
- What's the difference between the two properties
$user_object->caps
and$user_object->allcaps
? - Is there ever a situation where the capabilities listed in
$user_object->caps
WOULDN'T be found under$user_object->allcaps
? - Is there any reason I would need to use
$user_object->caps
or can I rely on checking$user_object->allcaps
for a particular user?