Can I hide menu items from non-members?
Yes you can!
Restricting menu items is done with the assistance of the Menu Item Visibility Control plugin.
Once activated, Menu Item Visibility Control will add an extra input field to each menu item, as shown below:
The visibility input field allows you to enter PHP conditional tags and the menu item will only be displayed if the conditional tags validate as TRUE.
If you want to only show a menu item to paid (and active) membership holders (regardless of their membership level), enter this in the input field:
If you wish to show a menu item only to non-active/non-paid members, then use:
The ! means "not".
If you wish to show a menu item to all active members, regardless of whether they are free or paid, then use:
rcp_is_active() || ( rcp_get_subscription_id() && 'free' === rcp_get_status() )
If you wish to show a menu item only to active members of a specific membership level, then use:
rcp_is_active() && rcp_get_subscription() == 'Gold'
Or by membership level ID:
rcp_is_active() && rcp_get_subscription_id() == 2
You can also show a menu item to active members who are on levels "Gold" or "Silver":
rcp_is_active() && in_array( rcp_get_subscription(), array( 'Gold', 'Silver' ) )
You can check for additional membership levels by adding more names to the list. For example:
rcp_is_active() && in_array( rcp_get_subscription(), array( 'Gold', 'Silver', 'Bronze' ) )
Here's the same but using IDs instead:
rcp_is_active() && in_array( rcp_get_subscription_id(), array( 2, 3 ) )
If you want to show a menu item to all expired members, perhaps to encourage them to signup again, use:
You must be very careful when entering the visibility options. A mistake could result in a whitescreen.