[wp-hackers] After adding custom role, admin panel becomes inaccessible

Andrew Nacin wp at andrewnacin.com
Tue Jun 29 21:47:13 UTC 2010


On Tue, Jun 29, 2010 at 10:10 AM, Alex Hempton-Smith
<hempsworth at gmail.com>wrote:

> So roles/caps are stored in the database? I thought they were just ran
> dynamically; thus didn't think I needed to remove any previously added
> ones.
>

They are indeed stored, as Jake said, which means you should not be adding
roles or caps on init, but rather as a one-off like activation (then remove
on deactivation). OR, you can do that Unfiltered MU does, and do it on init,
but avoid writing to the database. (Cheap hack, but gets the job done.)

That said, there is a $wp_user_roles global that can be used to hard-code
roles and capabilities in wp-config (and the DB would be passed). I know for
example this is what wp.com uses, so you should probably be aware of that as
well.


More information about the wp-hackers mailing list