Hooking into add_submenu_page

Hook into admin_head, the last action before the menu is rendered, and change the global $menu: add_action( ‘admin_head’, ‘wpse_71303_change_menu_cap’ ); /** * Change the capability to access an admin menu item. * * @wp-hook admin_head * @return void */ function wpse_71303_change_menu_cap() { global $menu; foreach ( $menu as $key => $item ) { // Find … Read more

When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?

It does not automatically create that capability in the sense that there is no new capability registered with WordPress. Instead it defaults to use the capabilities assigned to creating/editing posts. For example, if an author logs in they will be able to create and publish a new destination entry by default. You can override this … Read more

Listing all capabilities in dropdown is returning boolean

Solved with this Answer at Stack Overflow. Each Array Key was the actual name of the capability […] You were searching for the capabilities by name, and since you were only seeing 1s in the output, I figured what you were looking for was in the keys. foreach($capslist as $cap=>$caps){ $dropdown .= ‘<option value=”‘.$cap.'”>’.$cap.'</option>’; }

Allow user to Publish, but not Edit or Delete

I am not sure what you’re trying to do by not allowing Edit. Its only a job of Publishing the post it seems. (or maybe add some Meta description etc) But, if you’re looking at creating a Moderator, you need to create additional user group & assign permissions. You can try http://wordpress.org/plugins/advanced-access-manager/ or similar plugins … Read more

How can I prevent users from creating new categories?

You should to remove a capability named ‘manage_categories’ from user role or roles, for example: /** * Don’t let subscribers add/edit/remove categories. * * You should call the function once when your plugin or theme is activated. * * @uses WP_Role::remove_cap() */ function remove_subscribers_manage_categories() { // get_role returns an instance of WP_Role. $role = get_role( … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)