12

I've been having a difficult time adding custom post type capabilities to roles (Adding capabilities to default roles) and I suspect that my muddling around may have caused some problems. I also have installed and de-installed various plugins some of which added capabilities. As a result My WP Role object is a bit of a mess. Does anyone know of a way to reset capabilities or do I need a fresh install?

4

I use User Role Editor. You can delete added roles, and reset roles from the plugin page.

To reset the administator role, you can, as of WP 3.4+, add

define('URE_SHOW_ADMIN_ROLE', 1);

to your wp-config.php file. After having done so, you need to go to Users > User Role Editor and click "Reset".

| improve this answer | |
  • Can I use it and then de-install it? – mantis Jul 3 '13 at 21:20
  • Yes, since you are just resetting the roles back to the original state, there should be no problem with deleting the plugin. – livearoha Jul 3 '13 at 21:31
  • Ok, I'll give it a go then. – mantis Jul 3 '13 at 21:34
  • As with any plugin, I would recommend copying your database beforehand, just in case it doesn't do what you want you always go back. – livearoha Jul 3 '13 at 21:39
  • 1
    @bungeshea Point 3 of "When should I edit posts?" (on the very page you linked to) reads "To include additional information only found in comments, so all of the information relevant to the post is contained in one place" --> That's what the user mantis did. How's that not okay? – Johannes Pille Jul 4 '13 at 8:26
25

If you don't want to install a plugin to just to do this one task, you can call the WordPress function directly to rebuild the roles and their capabilities.

if ( !function_exists( 'populate_roles' ) ) {
  require_once( ABSPATH . 'wp-admin/includes/schema.php' );
}

populate_roles();
| improve this answer | |
  • 1
    Thanks! it worked like a charm and was difficult to find. – Kevin Mamaqi Jan 10 at 18:31
  • This is the most simpler and robust solution that restores all the standard roles and caps in the WordPress way. This should be a selected answer. Thanks a lot. – pixelngrain May 24 at 4:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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