If Menu - Visibility control for menu items

⭐️4.6 (101)

Plugins | Site Design | Menus

If Menu - Visibility control for menu items

Control what menu items your site’s visitors see, based on visibility rules.

500k+ downloads
70k+ active installations
Tested up to WP 5.4.2

← If Menu - Visibility control for menu items

Frequently Asked Questions

πŸ”—If Menu is broken, no visibility rules are available

There’s a known limitation with adding functionality for menu items in WordPress, and conflicts may happen between some plugins and themes.

If there are multiple plugins that extend Menu Items, for example If Menu and a plugin for Menu Icons, only one of them can add the needed functionality and the other one won’t work as expected.

This is an ongoing issue with WordPress which hopefully will be fixed in a future release.

If the “Menus” page is blank or options for visibility rules are not displaying, there is a way to test which plugin/theme causes this conflict.
Please disable other plugins or themes until you find the one that causes the problem, and contact the respective developers.
In the message include the link to WordPress ticket about menu items https://core.trac.wordpress.org/ticket/18584 where they can see detailed info on how to fix the problem.

πŸ”—Changes to menus are not saved

This problem may happen on sites with a large number of menu items.
In most cases, this is not a limitation or problem caused by plugins or WordPress, but by the hosting server.

Your hosting provider or server limits the amount of data that can be sent to WordPress for saving in database.
The setting is named “PHP max_input_vars” and it’s value should be increased, ex: max_input_vars = 200 to max_input_vars = 500.
Contact your hosting provider or make the change yourself if you have access. More details can be found here https://core.trac.wordpress.org/ticket/14134

πŸ”—How can I add a custom visibility rule for menu items?

New rules can be added by any other plugin or theme.

Example of adding a new custom rule for displaying/hiding a menu item when current page is a custom-post-type.

// theme's functions.php or plugin file
add_filter('if_menu_conditions', 'my_new_menu_conditions');

function my_new_menu_conditions($conditions) {
  $conditions[] = array(
    'id'        =>  'single-my-custom-post-type',                       // unique ID for the rule
    'name'      =>  __('Single my-custom-post-type', 'i18n-domain'),    // name of the rule
    'condition' =>  function($item) {                                   // callback - must return Boolean
      return is_singular('my-custom-post-type');
    }
  );

  return $conditions;
}

πŸ”—Where can I find conditional functions?

WordPress provides a lot of functions which can be used to create custom rules for almost any combination that a theme/plugin developer can think of.

Support

  • Version: 0.16.1
  • Last updated: 08 Apr 2019
  • Tested up to WordPress 5.4.2
  • Requires PHP 5.4 or higher
  • FAQ
  • Support forum ❐

Still need help?

Please visit the Support forum on WordPress.org