WordPress - Limit customspecific user role to only have access to edit the contents of an Advanced Custom Fields Pro Options Pag

admin2025-01-08  4

I've tried a few role plugins already: Members, User Role Editor, User Role Field Setting for Advanced Custom Fields Pro (this doesn't apply to an options page--just ACF fields on their own), Capability Manager Enhanced, and I could not get them to target the Options Pagee I created for the site in functions.php:

$acf_args = array(
    'page_title' => 'Editable Content',
    'menu_slug' => 'editable-content',
    'capability' => 'manage_options'
);

acf_add_options_page( $acf_args );

I tried adding the capability attribute but that didn't seem to allow for a specific user role to target just the Options Page. Any user role can access the Options Page--but only a specified role can edit the Options Page and nothing else in the admin. (It is ok if this specified user can view pages, posts, plugins, etc--but they can't edit, add, update, or delete anything).

Is there a way I can make this happen? Can I somehow use one of the aforementioned plugins as well as additional code in functions.php? Or am I limited to just adding something to functions.php? I've dealt with WordPress user roles in a basic sense before, but not in such a specific way like now....

I've tried a few role plugins already: Members, User Role Editor, User Role Field Setting for Advanced Custom Fields Pro (this doesn't apply to an options page--just ACF fields on their own), Capability Manager Enhanced, and I could not get them to target the Options Pagee I created for the site in functions.php:

$acf_args = array(
    'page_title' => 'Editable Content',
    'menu_slug' => 'editable-content',
    'capability' => 'manage_options'
);

acf_add_options_page( $acf_args );

I tried adding the capability attribute but that didn't seem to allow for a specific user role to target just the Options Page. Any user role can access the Options Page--but only a specified role can edit the Options Page and nothing else in the admin. (It is ok if this specified user can view pages, posts, plugins, etc--but they can't edit, add, update, or delete anything).

Is there a way I can make this happen? Can I somehow use one of the aforementioned plugins as well as additional code in functions.php? Or am I limited to just adding something to functions.php? I've dealt with WordPress user roles in a basic sense before, but not in such a specific way like now....

Share Improve this question asked Aug 19, 2019 at 19:27 gallifrey1212gallifrey1212 1155 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

So, I went and found a plugin called Adminimize https://wordpress.org/plugins/adminimize/ that allows me to show/hide admin menu items based on user roles. This allowed me to show the Options Page as editable for the custom user role I made but prevent them from editing other parts of the site.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736269491a1356.html

最新回复(0)