With you current_user_can
call everything is just fine. The problem lies elsewhere…
If you’ll take a look at Roles and Capabilities, you’ll see that there is no capability like edit_post
. So your code is working correctly – admin can’t edit_post
, because there is no such capability (unless it’s a custom capability registered by your code elsewhere).
But my gut tells me that you wanted to check if current user can edit_posts
😉
Related Posts:
- What action should I hook into when adding roles and capabilities?
- What is valid timing of using current_user_can() and related functions?
- Allow Contributor to change the author of his own post?
- What’s the difference between Role and Meta capabilities; When to use map_meta_cap() filter
- How can I grant capabilities directly to users (not roles) in wp-admin?
- Disable posts, only allow to edit existing pages, not create new ones (create_posts)
- How to get all capabilities of an existing user role
- What exactly is WordPress?
- Menu capability in WordPress
- Does the “promote_users” capability allow someone to create a new admin account?
- current_user_can( ‘edit_post’, $post_id ) does not work for contributer but for administrator
- Add user capability and check against it
- Listing all capabilities in dropdown is returning boolean
- Add Media Upload Capabilities Needed for Custom Role for non-Posts
- add_cap only adding the first two in array
- How can I prevent a writer from being able to edit an article that has been scheduled?
- Check whether user can delete a given post
- Multiple Authors on Single Post
- Allow unfiltered HTML in titles for low level users?
- Allow users to set a post author
- Unify the roles and caps?
- Remove menu items from admin page and limit capabilities
- Filter list of rules based on a capability
- Using author_can() on custom post types in WordPress
- How to show a admin bar menu item only to users with certain capabilities?
- Restricted user capabilities cannot add image
- User capability per post
- How come I see a manage_categories capability but not a manage_tags capability for any users?
- Theme option editing capability problems
- Allow Contributor to edit published post and filter by page id
- Usage of current_user_can()
- Is it wise not to use only meta capabilities for certain basic post types?
- Remove capability from specific user
- What capabilities are assigned to unauthenticated users?
- Capabilities Not Changing
- Assign multiple roles , overlapping capabilities
- Administrator role capabilities
- How to get all capabilities
- Prevent all users from editing posts except admins using hooks
- WordPress remove capability post ,media completely for custom role
- Add capability to “Editor” role to be able to view all users attachments
- Why cannot author edit pages?
- Add capability to a role , so user is only able to view his own posts
- Plugin page and capabilities
- how to change capability required to view an admin page? [duplicate]
- How can restrict certain users from delete a category but can view only in wordpress?
- Delete admin edit/delete links in users list wordpress admin
- Create a Capability category to group a few custom Capabilities
- Capability to edit post slugs
- admin can not change author profile picture
- Changing capability type without altering plugin
- Can’t create new Pods pages
- Is there a way of retrieving the core WP capabilities?
- Pricing Tables admin page capability
- Best Roles and Capability on a site with review features using a front end custom post
- Not able to give editors acess to new admin menu item
- Manage Roles and Capabilities on Multi-site
- Custom post type role permissions won’t let me read
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- Groups of capabilities: users with multiple roles?
- Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter
- Possible to make custom role in multisite that can add sites?
- How to enable the theme editor cap for an editor role?
- Editor role cannot save custom theme options
- Custom Post Types – Capability Type
- How to Structure a New Role/Capability Scheme?
- When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?
- How to remove sticky post capability for a specific user role?
- Let new user role to ‘edit_others_posts’ of other user role, not of its own type
- Notice: Undefined property: stdClass::$delete_posts with custom post type
- Add custom capabilities to existing custom post type
- allow edit of custom post type but not regular posts?
- Users with custom roles can’t read each other’s comments
- How to safely allow user upload on CPTs?
- Allow Author on Site A capability to upload files on Site B in Multi Site
- Where are the WordPress capabilities stored?
- Custom user roles for access to specific parts of the site
- Add, edit specific CPT with custom role
- Allow users with Editor role to edit menus (without a plugin)
- Subsite access without being a member of the subsite in wp multisite network
- How can I add a custom role capability to use in a custom plugin?
- Reset Roles (or undo role changes on theme change)
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- Conflict between Capabilities and Menu Visibility with Custom Post Types
- How to handle this specific case of custom post type?
- Custom Post Type not working with Capabilities
- insufficient permissions; coding an action for plugin governed by custom capability
- remove “Edit” from select pages
- User role and capablities only for 1 plugin
- Restricting shortcode for users
- How can I add capability to multiple roles?
- Disabling user capability to edit_posts or delete_posts in the front-end
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- Remove capability to interact with a page
- How to add a menu page for options in wordpress for user that has the role of vendor?
- What would prevent a custom role from viewing posts (both standard and custom)?
- Custom post type & role issues
- Sync roles across several plugins
- edit slider plugin capability for custom_role
- Make plugin admin page visible to other roles