I am working on a website with Membership Access Levels
I created a Gold/Silver/Bronze Level and assigned it to the Users Field.
I have also created Custom Fields that you assign the content using multiple select one or more of these fields.
I am trying to understand can I hide menu items or submenu items from displaying based on the users current logged in membership level?
My goal is to do everything through ACF instead of using additional third party plugins.
Any feedback, videos or code examples would be greatly appreciated.
I’m not sure that I understand completely what you mean but if you’re talking about the main WP Admin menu on the left. This would be accomplished where you are adding those admin pages. If your using ACF to add options pages, then you would set the capability required to access the options page. When creating a custom post type or taxonomy, these functions also have capability settings that would be used.
For standard WP admin pages you can try this https://www.wpmayor.com/how-to-remove-menu-items-in-admin-depending-on-user-role/
I’m not referring to the menu’s that exist in the admin area. I am referring to menus that I create for navigation purposes. For example I may want to hide possible menu selections in my navigation for users that are not logged in or perhaps this menu selection would only be available for gold lever members. Another example might be if I have a menu selection item that says login. I would want to alter the content of that menu to logout once the users has logged into the account.
If we’re talking about front end menus then this really doesn’t have much to do with ACF, unless you need to get a value from ACF to determine if the user should have access. The login/logout feature is a matter of checking to see if the user is logged in or not and showing the correct link. What you need to do is look for information on restricting access to pages and building custom menus for the front end of the site. You might try these
Thank you for your response. I suspected it might not do what I needed but the plugin is so powerful I didn’t want to assume what it could and could not do.
I have looked into the Nav Roles Plugin and will explore it a little further.
Before I close this thread can ACF create additional roles or should I use a role management plugin like https://wordpress.org/plugins/user-role-editor/
The topic ‘Restrict/Hide Menu Items’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!