Articles of capabilities

Plugin page and capabilities

i´am developing my own WP plugin with custom functions and i would like to show the new submenu in the standard admin panel for everyone, who logs in. My code: $capa = ‘administrator’ or ‘author’ or ‘visitor’; $this->pagehook = $page = add_menu_page(__(‘Myplugin’,’my_plugin’), __(‘Myplugin’,’my_plugin’),$capa, $this->page_id, array($this,’render’) ) As you can see, i defined 1 variable $capa, […]

Unable to access custom plugin backend

So, I just created a new plugin and i’ve added capabilities, a new role, linked them all together, etc.. etc.. but for some reason I’m unable to access my own backend. Error message is the generic You do not have sufficient permissions to access this page. Code to create the Menu on the backend add_menu_page( […]

Wp custom post custom capability not working togather

I am trying to make a custom post type editable by a group of people (i.e. The users department) instead of only the author. I don’t want to let them edit posts created by people of other groups(department). To solve this issue, I am using map_meta_cap filter to map the custom capabilities. Which is actually […]

Let editors view post in admin but not be able to perform a save/edit

In a current project I need to be able to restrict access to posts by comparing the post’s language against the languages a user has access to. This, I’m certain I can achieve. However, even if a user should not be allowed to edit the post the user should be able to view the post […]

Limit role to one plugin

This question already has an answer here: How do I create a custom role capability? 2 answers

Redirect admin 403 “Cheatin uh?” admin pages

Blocking role capabilities on the admin returns the 403 “Cheatin Uh?” page. What is the best way to redirect this to 403 page to perhaps the dashboard, homepage, or a custom 403 page? I know I could probably achieve this using .htaccess, but I’d prefer to stick with php / wordpress related functions. For example […]

Custom Post Type – after disable 'Add New', I can't edit and delete post

I need to disable ‘Add New’ button for my CPT, but when I add: ‘capabilities’ => array( ‘create_posts’ => false, ‘edit_posts’ => true, ‘edit_post’ => true, ‘delete_post’ => true, ), I can only VIEW this post (I can’t edit and delete it) – why?

current_user_can('administrator') not working in custom login

I am using a custom login form on a site and I’m having trouble with redirecting admins to the dashboard automatically. Below is the login function function auth( $username, $password, $redirect ) { global $user; $credentials = array(); $credentials [‘user_login’] = $username; $credentials [‘user_password’] = $password; $credentials [‘remember’] = true; $user = wp_signon( $credentials , […]

WordPress remove capability post ,media completely for custom role

I have created a new role .Now I want to remove post ,media, setting capability for that role. How can I achieve this?

How to handle this specific case of custom post type?

I’m working on a WP plugin called WP SoundSystem. It’s a plugin designed to run on a “music” website : it handles artists, tracks, albums, playlists… through custom post types and tools. You can see it running on Spiff Radio. When I publish a new playlist, my function checks every track row from the tracklist […]