Home Forums General Issues Hide ACF from Admin Menu if User is not Custom User Role


Hide ACF from Admin Menu if User is not Custom User Role

  • This feels like one of those things that should be simpler than it is (and it may be), but I’m struggling to find a non-plugin driven answer for this. We want to create a new user role that has the same capabilities as an administrator, but then we want the ACF plugin to only show for that new custom user role.

    I’ve got the custom user role set and read this tutorial from ACF.

    However, the issue I seem to be running into is that the only conditional I can seem to find all hook into is current_user_can or something else that’s based around capabilities. Since the custom user role and Administrators have all the same capabilities and are only different in name only, there’s no good way I can find to hide it for Administrators that won’t also end up hiding the plugin to the Custom User Role I’ve created.

    Has anyone run into this or have a solution for this where I can simply tie into the user role string name instead of capabilities?

  • You can use the role name in current_user_can()

    for example

    if (current_user_can('administator')) {...


    if (current_user_can('custom role name')) {...
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.