HowTo: Disable Access to the WordPress Dashboard for Non-Admins

Update: I had a few requested to bundle this into a plugin so I did. You can download it here.

Currently, I’m working on a site where we didn’t want non-admins to even be able to access the wp-admin dashboard. I searched around quite a bit looking for a complete shutoff-solution but most of the results detail how to literally disable the “Dashboard” menu in wp-admin.

Finally, trolling the comments on a like-solution in a post by c. bavota, I stumbled across a simplified version of bavotasan’s function that does exactly what I want, plus it redirects unworthy users to the homepage!

The simplified function was authored by somebody going only by the moniker of Jake.

It’s a pretty simple solution. It adds an action calling a function called ‘redirect_dashboard’ which checks the user level, and if the currently-logged-in-user is unworthy, they get bounced to the homepage. Pretty neat. On line #4, the function checks the user level, with the default set as ‘level_10’ or administrator. I modified this to ‘level_7’ to exclude anyone below the Editor level, but you could choose whichever capability level suits your purpose. Vist the Roles and Capabilities Codex page to find out more about user levels.

Here’s the snippet (which should be added to your theme’s functions.php file)

add_action('admin_init', 'no_mo_dashboard');
function no_mo_dashboard() {
  if (!current_user_can('manage_options') && $_SERVER['DOING_AJAX'] != '/wp-admin/admin-ajax.php') {
  wp_redirect(home_url()); exit;

A frustrating journey to Joomla and back

Photo by Flickr/gagilas. Used with permission under Creative Commons License.

I was recently named to the Denver Press Club Board of Directors and one of the duties I volunteered for was to take over website updates for the club.

Turns out they use Joomla, and while I dabbled with it some in the days before 1.0, I’d never really found it that intuitive. Unfortunately, not much has changed.

My first instinct upon login was to figure out how the structure worked. I guess it is only natural that with CMS systems like these that there’s and inherent lingo that goes along with them. With WordPress, I’m used to lingo like widgets, posts and pages. In Joomla, I’m dealing with articles (posts), components (?), modules (widgets?) and plugins.

At this point, I don’t have a lot of time to dive into the documentation to figure out what’s what, but I figured it can’t be that hard to figure out how this works, right? Boy was I wrong.

As far as I can tell, there’s almost no intuitive interfaces in this whole mess of menus and action buttons. I would kill to be able to juggle around modules and article blocks in a drag and drop interface. Or even have an opportunity to make sense of the source code. But it seems I’m relegated to reordering elements manually and attempting to decipher this smorgasbord of menus and submenus.

I thought the WordPress Media Library needed work, but Joomla Media Manager takes the cake. There’s no capability to select a group of images (or any other media) all at once. You CAN upload many at a time, but you have to add them to the queue one at a time. What a bore. Isn’t this supposed to be fun?

I could keep writing all day about the frustrations I had using Joomla but I won’t. I’ll just offer some advice to those folks, take a look at what Drupal and WordPress have been doing and take a lot of notes. Because your CMS needs a lot of work.