When setting a user’s role in WordPress, is the string I use for role case sensitive? For example, should I be using
wp_update_user( array( 'ID' => $user_id, 'role' => 'Editor' ) )
or
wp_update_user( array( 'ID' => $user_id, 'role' => 'editor' ) )
Or doesn’t case matter in this situation?
Ref: http://codex.wordpress.org/Function_Reference/wp_update_user
Short answer: Yes, case matters.
Some details: if you inspect WP_User::set_role() in /wp-includes/capabilities.php you will notice that there is no sanitization executed on the $role variable. And because PHP array keys are case-sensitive, “Editor” and “editor” would reference two different roles.