How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?

The problem is that when the special subscriber tries to Add New a sub-cpt post, it is denied permission. However, when the CPT menu is a top-admin-menu, then everything works out fine. The issue is related to the placement of the CPT’s UI menu in the back-end: if it’s top-level (show_in_menu=TRUE), all is well; if … Read more

Prevent author role from editing all posts in custom post type?

You should declare your desired capabilities when you are registering the post type. Justin’s article here is a good one for custom post types: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress When you are registering your custom post type, you can set this to be standard capabilities for posts, eg: ‘capability_type’ => ‘post’, or to be standard capabilities for pages, eg. … Read more

Custom role capabilities to administrator not taking effect (no plugin)

Capabilities are stored in database, that is why they keep active even if you remove your function. Capabilities need to be expressly removed: $admin = get_role(‘author’); $admin->remove_cap( ‘edit_teacher’ ); And, because they are stored in database, you should stop adding them in every page load (as you are doing in init event). Usually, you should … Read more