Skip Navigation

[Resolved] Conditional menu item hiding

This support ticket is created 5 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 3.95 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 5 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#1340499

Ive got the plugin that allows me to hide certain menu items for different user types, but I would like to hide them based on slightly more complex conditions.

Specifically, once someone has submitted their personal bio, I would like to remove the "Upload bio" page from the menu! This would make it a lot more user friendly, but perhaps not easy to achieve?

#1340659

Hello,

There isn't such kind of built-in feature within Toolset plugins, you might consider custom codes, for example:
1) Use filter hook wp_get_nav_menu_items to trigger a PHP function:
https://developer.wordpress.org/reference/hooks/wp_get_nav_menu_items/

2) In this function, check if current user has a personal bio post:
https://developer.wordpress.org/reference/classes/wp_query/#author-parameters

If there is existed personal bio post, then hide specific item.