Title: Conditionally hide menu items
Last modified: August 21, 2016

---

# Conditionally hide menu items

 *  [superpotion](https://wordpress.org/support/users/superpotion/)
 * (@superpotion)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/)
 * Forgive me if this has been asked before.
 * There are a number plugins that will provide a way to conditionally hide or show
   a menu item (see [https://wordpress.org/plugins/menu-items-visibility-control/](https://wordpress.org/plugins/menu-items-visibility-control/)
   example).
 * Are there any specifically for PMPro that will hide/show a menu item depending
   on membership level?
 * Failing that, what PMPro conditions can be used in the plugin mentioned above?
 * [https://wordpress.org/plugins/paid-memberships-pro/](https://wordpress.org/plugins/paid-memberships-pro/)

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [mlzorko](https://wordpress.org/support/users/mlzorko/)
 * (@mlzorko)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058784)
 * I am interested in this feature as well. I use “membership” and this is a function
   that is allowed and is outstanding –
 *  [Jessica Oros](https://wordpress.org/support/users/jessica-o/)
 * (@jessica-o)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058814)
 * Hey guys,
 * There are a few ways to do this, but unfortunately all will require some custom
   code depending on what you’re trying to exactly. However, if you just want to
   hide membership restricted posts entirely from non-members, you can use the “
   Filter searches and archives?” feature in Memberships > Advanced Settings.
 * Try that, and if it’s not what you’re looking for exactly, let us know.
 * Thanks,
    Jess
 *  [rdcravens](https://wordpress.org/support/users/rdcravens/)
 * (@rdcravens)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058870)
 * I am interested in hearing about the custom code. Has anyone done this? The menu’s
   are the hiccup for me right now… Here is the example (assume 2 levels: Level 
   1 & Level 2):
 * **No login Menu:**
    Welcome::Demo::Terms::About::YadaYada
 * **Level 1 Login:**
    Welcome::Level 1 Menu Items::Terms::About::YadaYada
 * **Level 2 Login:**
    Welcome::Level 1 Menu Items::Level 2 Menu Items::Terms::About::
   YadaYada **OR** Welcome::Level 2 Menu Items::Terms::About::YadaYada
 * Is this possible?
 * I used a different plugin to do this, but the subscription options were not near
   what I needed, so I have to change. This is all that I think is missing from 
   this plugin to be a totally complete solution for a website… Awesome plugin so
   far – just the menu’s might be a deal breaker for me…
 *  Thread Starter [superpotion](https://wordpress.org/support/users/superpotion/)
 * (@superpotion)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058871)
 * You can use the plugin that I mentioned above ([https://wordpress.org/plugins/menu-items-visibility-control/](https://wordpress.org/plugins/menu-items-visibility-control/)),
   building conditional tags using PMPro’s `pmpro_hasMembershipLevel()` function.
 *  [rdcravens](https://wordpress.org/support/users/rdcravens/)
 * (@rdcravens)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058872)
 * Nice… Great find and solution… This is perfect.
 * So is the usage just as simple as the Level ID joined with OR (if you need multiple
   levels to have access) or did you find it a bit more challenging than that?
 * pmpro_hasMembershipLevel() == 1 OR pmpro_hasMembershipLevel() == 2 OR pmpro_hasMembershipLevel()
   == 3
 *  Thread Starter [superpotion](https://wordpress.org/support/users/superpotion/)
 * (@superpotion)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058875)
 * The function returns true or false, usage examples:
 * pmpro_hasMembershipLevel(1)
    pmpro_hasMembershipLevel(‘Gold’) pmpro_hasMembershipLevel(
   array(0,2,’Silver’))
 * See: [http://www.paidmembershipspro.com/documentation/require-membership-function/](http://www.paidmembershipspro.com/documentation/require-membership-function/)
 *  [Jessica Oros](https://wordpress.org/support/users/jessica-o/)
 * (@jessica-o)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058876)
 * Thanks for that superpotion!
 * Has this been resolved?
 *  [rdcravens](https://wordpress.org/support/users/rdcravens/)
 * (@rdcravens)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058879)
 * Resolved 🙂
 * Now just need to find out how to import existing users and assign levels… 🙁
 *  [twicealive](https://wordpress.org/support/users/twicealive/)
 * (@twicealive)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058882)
 * [@rdcravens](https://wordpress.org/support/users/rdcravens/)
 * [PMPro Import Users from CSV](http://www.paidmembershipspro.com/add-ons/third-party-integration/pmpro-import-users-csv/)
 * So, what is the best way to php test for Has NO Level?
 * Thanks,
    Michael
 *  [rdcravens](https://wordpress.org/support/users/rdcravens/)
 * (@rdcravens)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058883)
 * Users already exist in the site, but not in PMPro… Is more of an exercise in 
   manual editing the user levels on the WP side. 🙁
 *  [twicealive](https://wordpress.org/support/users/twicealive/)
 * (@twicealive)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058884)
 * [@rdcravens](https://wordpress.org/support/users/rdcravens/)
 * The plugin lets you update existing users, allowing you to automatically assign
   membership levels to users, and populate numerous other pmpro fields, simply 
   by adding a few columns to your CSV file.
 *  [twicealive](https://wordpress.org/support/users/twicealive/)
 * (@twicealive)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058885)
 * Does anyone know what is the best way to test for “Has NO Membership Level”?
 * Thanks,
    Michael
 *  [Jessica Oros](https://wordpress.org/support/users/jessica-o/)
 * (@jessica-o)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058889)
 * Michael, you can use use the [pmpro_hasMembershipLevel() function](http://www.paidmembershipspro.com/documentation/require-membership-function/)
   with an ! (NOT operator) in front:
    `if(!pmpro_hasMembershipLevel()) { //do something}`

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Conditionally hide menu items’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/paid-memberships-pro_f1dacb.svg)
 * [Paid Memberships Pro - Content Restriction, User Registration, & Paid Subscriptions](https://wordpress.org/plugins/paid-memberships-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/paid-memberships-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/paid-memberships-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/paid-memberships-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/paid-memberships-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/paid-memberships-pro/reviews/)

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [hide](https://wordpress.org/support/topic-tag/hide/)
 * [items](https://wordpress.org/support/topic-tag/items/)
 * [menu](https://wordpress.org/support/topic-tag/menu/)
 * [paidmembershipspro](https://wordpress.org/support/topic-tag/paidmembershipspro/)
 * [pmpro](https://wordpress.org/support/topic-tag/pmpro/)
 * [show](https://wordpress.org/support/topic-tag/show/)

 * 13 replies
 * 5 participants
 * Last reply from: [Jessica Oros](https://wordpress.org/support/users/jessica-o/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/conditionally-hide-menu-items/#post-5058889)
 * Status: not resolved