I asked this question over on the WordPress StackExchange but was told it was off-topic for there. I hope it is correct to ask it here instead.
A client has asked that I setup the Contributor role in WordPress so that it can only view/edit/delete their own posts from a CPT called ‘members’. I have done this using Justin Tadlock’s Members plugin + a small snippet of code since they only want the Contributor’s to be able to see their own posts & not others (even if they can’t edit them).
Everything is working well except for Advanced Custom Fields. The client is using this to provide extra fields on the ‘members’ CPT, but unless I give the Contributor role the ‘edit_others’ capability they are unable to see the fields created by ACF.
Is this an issue with ACF, or with WordPress? I am still fairly new to Roles & Caps and I cannot seem to understand how to change this. If possible I would like the ACF fields to be visible on the ‘edit_members’ capability.
Add the ‘edit_others_posts’ to your user role.
I had same problem, and after some trying out different combinations, have found that this capability needs to be enabled.
The problem is not in roles or capabilities, problem is how you limit the edit-posts dashboard for non-administrators. Your if-statement should not be performed on edit-post page, only at post listing page (for example, if you use
pre_get_posts
to restrict posts editing for admins only, then you must not run thispre_get_posts
function at posts.php page).Also example from ACF support forum.
This issue has been posted a long time ago, but I believe there is still someone facing it at the moment. So I would like to make it easy to understand.
First of all, we have to separate it into two parts.
First, the relationship between user, role, and capability. Let’s say, each user has a roles, and each role has capabilities. It is one-to-many relation from top down.
Second, custom post type(CPT), advanced custom field plugin (ACF) and ACF extension plugin.
Each custom post type can be done for a specific capability and all fields under the custom post type has been done by using ACF.
Lastly, not all fields need to appear on every user who has the role that included this capability. Some field need to be appear for just for some specific role which has this capability included. This is where ACF extended plugin step in. It is sound complicate isn’t it? Let have a look the chart below.
With acf_permission, you can be able to specific the role for be able to see the field like below.
This might not fully answer the question but hope it will help to clear how does it work together.
https://www.acf-extended.com/features/field-groups/permissions