WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My current user role is "Administrator". I'd like to change my role to "Editor" (through out database field).

I read Database_Description, but it did not help.

share|improve this question

Either use wp_update_user

    array (
        'ID' => 1, // replace by your user ID
        'role' => 'editor'
) ;

or the set_role method of the WP_User class.

$you = new WP_User( 1 ); // again, replace parameter by your user ID
$you->set_role( 'editor' );
share|improve this answer
Final answer got it. Table of wp_usermeta ->a:1:{s:6:"editor";s:1:"1";} insted of a:1:{s:13:"administrator";s:1:"1";} field. 'S' for number of character in string Prove – Ravi Parmar Apr 3 '13 at 13:17
[sarcasm on]Yes, that's much better than using an API.[/sarcasm off] – Johannes Pille Apr 3 '13 at 13:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.