Multiple Authors on Single Post

I want to throw this out there as an answer to the question. I have stumbled across a plugin that will take WordPress’s permissions to the next level. It is called Press Permit. http://presspermit.com/extensions/pp-collaborative-editing/ Taken from Press Permit FAQ’s: How does Press Permit compare to Capability Manager, User Role Editor and other role editor plugins? … Read more

Check whether user can delete a given post

After hours of fighting to get this to work, it was just a matter of changing delete_posts to delete_post. So, in it’s entirety this would be: current_user_can(‘delete_posts’, $post_id); to current_user_can(‘delete_post’, $post_id); current_user_can does accept a second parameter. Though it’s weird that the function declaration in capabilities.php does not define a second parameter as pointed out … Read more

How can I prevent a writer from being able to edit an article that has been scheduled?

Me, like @fischi think that filter ‘user_has_cap’ is the best choiche for the pourpose, however, I think that is better to the work, regardless the $_GET post or action: WordPress check the meta cabability on a per-post basis, using an additional argument. In few words, when filtering ‘user_has_cap’ for a meta capability (see https://codex.wordpress.org/Function_Reference/map_meta_cap) we … Read more

Add Media Upload Capabilities Needed for Custom Role for non-Posts

Found the basic problem! Although a different context than the one you described, the root cause is probably the same. I was trying to allow users to setup a personal page and upload an image to display there. I kept getting the dreaded “You don’t have permission to attach files to this post”. The message … 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>’; }

current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator

using map_meta_cap I added edit_post per post cap to user function my_map_meta_cap( $caps, $cap, $user_id, $args ){ if ( ‘edit_post’ == $cap ) { $post = get_post( $args[0] ); $post_type = get_post_type_object( $post->post_type ); $caps = array(); if ( $user_id == $post->post_author ) $caps[] = $post_type->cap->edit_posts; else $caps[] = $post_type->cap->edit_others_posts; } return $caps; } add_filter( … Read more

Menu capability in WordPress

Capability parameter of add_submenu_page() function can only take a single capability, so if you are using the built in roles you can select a capability fro the long list that both administrators and editors have any of these (use any of these freely): moderate_comments manage_categories manage_links unfiltered_html edit_others_posts edit_pages edit_others_pages edit_published_pages publish_pages delete_pages delete_others_pages delete_published_pages … Read more