WordPress Capabilities: edit_user vs edit_users

The official documentation only mentions edit_users, but in the source I found many places are using edit_user, what is the difference?

Are there any conventions for singular and plural capabilities? e.g. edit_post vs edit_posts?

1 Answer
1

I found a few references to edit_user as a capability, one of which is this:

// Allow user to edit itself
    if ( 'edit_user' == $cap && isset( $args[0] ) && $user_id == $args[0] )
    break;

http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/capabilities.php#L1005

I believe the comment in that block of code answers this question.

Per @PatJ, it looks like map_meta_cap converts (in a sense) edit_user into edit_users but only if the user attempting to edit the profile is the profile’s owner, thus allowing users who otherwise have no user edit capabilities to edit their own profile information.

Leave a Comment