As far as I know, you can not (easily) set up a custom capability for a certain post/page ID. What is described in the Codex, are the so-called meta capabilities (a set of predefined capabilities with additional arguments/information).
A (not-that-easy) way is to write your own my_add_cap, my_current_user_can, my_has_cap etc. functions.
Regarding your follow-up question…
You could choose to not add/check the capability download_doc with an ID as argument, but the unique ID-based capability download_doc_{$ID} instead.
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?
- current_user_can capabilities in the admin not working as expected
- 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
- 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
- Force logout when role is changed
- How do I make a draft post accessible to everyone?
- Allow roles below admin to add subscribers only
- Disallowing Users of a Custom Role from Deleting or Adding Administrators?
- Add Custom User Capabilities Before or After the Custom User Role has Been Added?
- WordPress Capabilities: edit_user vs edit_users
- Do not allow users to create new posts and pages
- Notice: map_meta_cap was called incorrectly
- Capability to edit own posts and not others
- Do custom user roles have any default capabilities?
- Remove upload_files capability from a role but allow role to manage an avatar image
- How to not allow custom roles to edit published custom post types?
- Prevent author role from editing all posts in custom post type?
- User capability of create page/new page
- Including only current user’s posts in search
- Remove wordpress author’s capability to moderate comments on their own posts
- Cannot attach media when capabilities added to custom post type
- Add condition of user capability in WP_query
- Role capability delete multiple post type posts doesn’t work
- How do you set up a WordPress blog with multiple authors to allow something like StackExchange’s “community wiki” feature?
- Applying roles to an admin sub-menu (eg Appearance -> Menus)
- Show metabox for a special role
- Restrict Access to Posts based on Custom User and Post Meta Data
- Custom capabilities to add, edit, remove users of a particular role only?
- Restricting Pages based on Hierarchy and User Role
- Create a custom capability to allow an ‘Editor’ to edit only ‘Subscriber’ users
- Unable to delete custom post types, confusion around capabilities
- How can I promote a user to a network administrator?
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- What is the name of the user capability to read a reusable block?
- Create sub-administrator role that can do everything except use or see the code editor
- Restrict access to custom post type based on its taxonomy terms
- Restrict access only of custom post type with standard capabilities to edit_post
- cannot get global $menu value in form request
- CPT requires manage_options and edit_posts for some reason
- Allow contributor user role to perform copy operation PHP
- Restrict specific private page to a specific user
- Enable plugins for a specific user role
- Subscriber role – blank page
- Capability to read/edit page in wp-admin only for administrators
- How to add post of custom type to a category with custom type capabilities
- Understanding capabilities parameter in register_post_type()
- Why is user_can_access_admin_page() an undefined function?