Wordpress - what's the meaning of the field wp_capabilities in table wp_usermeta

The wp_capabilities saves the value as serilized array, you can try it in your php or for this example here: http://blog.tanist.co.uk/files/unserialize/.

The Code:

a:1:{s:13:"administrator";b:1;}

Is:

Array
(
   [administrator] => 1
)

Meaning the user is an administrator.

You can add new roles to the database by running the function add_role, and only run it once!


In addition to @Krysiek's answer, you should know that the data stored in the meta tables, including user metadata, is often serialized. If you'd like to know what the data actually represents, you can use the PHP function unserialize to determine it's value. For example, running the value a:1:{s:13:"administrator";b:1;} through unserialize (and then var_dump-ing the results) products this:

array(1) {
    ["administrator"]=>
    bool(true)
}

You will find the same sorts of entries in the options table as well as the post_meta table.

However, you should avoid writing to these tables directly. There are WordPress functions that allow you to store and access data about users. For example, to read data from the user meta table, you should use get_user_meta and to write you should use the WordPress function update_user_meta. Similar functions exist for post_meta and options tables.