Skip to main content

How to Hide Menu Items Based on Tags?

Is it possible to hide a menu entry for people with certain tags?

I would like to hide signup and shop menu items from members who already purchased.

I can hide custom built menu links in Bricks Builder, but it would be nice to do it for the standard Wordpress menu so I don't have to custom build my menu.

I know this is probably a long shot but it would be neat.

Sascha Leem

I think the easiest way is to add "WP Fusion" Plugin, which integrates natively with FluentCRM tags and lets you set visibility rules directly on each menu item in the WP menu editor. The free "Lite" version should be good.

Nicolai

Thanks Sascha Leem I'll look into that.Β 

Nathan Foley

Something like this would work https://techarticles.co.uk/seasonal-menu-items-in-wordpress/

You would need to add in something like this

// -------------------------------------------------
// Hide matched items if FluentCRM tag exists
// -------------------------------------------------
$hide_tag = $rule['hide_if_fluentcrm_tag'] ?? '';
if ($user_has_fluentcrm_tag($hide_tag)) {
// Remove matched items from menu
$items = array_values(array_filter($items, function($item) use ($matched) {
return !in_array((int)$item->ID, $matched, true);
}));

break; // first matching rule wins

You'd also need to identify as part of the rules which tag you wanted to use for hiding something like this

'hide_if_fluentcrm_tag' => 123,