[wp-hackers] Using capabilities to remove posts, links and comments, but not menus.

Tom Barrett tcbarrett at gmail.com
Thu Nov 10 14:12:07 UTC 2011


I have an editor role for a theme with no posts, links or comments. I
understand that I could unset() the global $menu array to remove stop the
menu items form displaying, but I was hoping to do this with capabilities.

Currently I'm doing this:
  global $wp_roles;
  $editor = &get_role( 'editor' );
  $editor->add_cap( 'edit_theme_options' );

  $wp_roles->remove_cap( 'editor', 'edit_posts' );
  $wp_roles->remove_cap( 'editor', 'manage_links' );
  $wp_roles->remove_cap( 'editor', 'manage_options' );


I have mapped CPT and taxonomy capabilities onto 'page'. This works, except
that core calls wp_insert_post() to create menu items (and thus fails).

Is there a way around this using capaiblities?

-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list