Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

Either use wp_update_user

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
1  
[sarcasm on]Yes, that's much better than using an API.[/sarcasm off] –  Johannes Pille Apr 3 '13 at 13:23

Your Answer

 
discard

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.