Setting a user’s role in WordPress: Is the ‘role’ string case sensitive?

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

Read More
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

Related posts

Leave a Reply

1 comment

  1. 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.