how to add custom user capabilities using add_user_meta or something else?

Try passing the value without serializing it manually, because WordPress will do it for you anyway:

add_user_meta( $user->id, 'orewpst_capabilities', array( 'author' => 1 ), true );

or

update_user_meta( $user->id, 'orewpst_capabilities', array( 'author' => 1 ) ); // it will create the meta data for you if it doesn't exist already.

The s:23 means that you stored a string with 23 chars.

Hope it helps!

Leave a Comment