WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Sep 07 2012

How to Display a Different Menu Based on User Capabilities or Level

wp_nav_menu() has a filter, wp_nav_menu_args, right after it parses the function arguments. This essentially allows you to change the menu at any time. So, if you want to have a different menu for administrators, editors, authors, contributors, and subscribers, you can easily do this via the wp_nav_menu_args filter hook.

First, you will need to check the theme_location of the menu. If you utilize menu theme locations, as your theme should, then any time the location is empty, it is because of the Custom Menu widget. Personally, I wish WordPress would have placed that in the arguments; however, as it stands now, 3.4.2 and 3.5.0, it is what it is.

Use Justin Tadlock's Members plugin to create new roles and new capabilities to further expand this.

Written by Travis Smith · Categorized: WordPress

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Comments

  1. Grégoire Noyelle says

    September 8, 2012 at 3:34 am

    Thanks a lot Travis. I was looking for this kind of functionality with Genesis.
    I really love members. Very clean, simple, powerful

    Reply
  2. Hassan says

    September 16, 2012 at 1:34 pm

    I prefer this solution: http://wordpress.org/extend/plugins/menu-items-visibility-control/, it’s less code and a lot more powerful. :))

    Reply
    • Travis Smith says

      November 2, 2012 at 1:45 am

      That’s a nice plugin. Great idea!

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in