Support

Account

Home Forums ACF PRO Menu Item Depth Reply To: Menu Item Depth

  • I have not tried creating location rules for menus. My guess is that you’ll need to look at the information that ACF passes to the filter and then probably do some queries about the menu item in question to see if it is a sub menu. However, I don’t know how to do this. All I can do is give you some advice on how to see what information you have to work with. Basically, you can log information to your error log so that you can see what you have to work with.

    
    add_filter('acf/location/rule_match/menu_item_depth', 'acf_menu_depth_location_rules_match_taxonomy_depth', 10, 3);
    function acf_menu_depth_location_rules_match_taxonomy_depth($match, $rule, $options) {
    
      ob_start();
      echo 'RULE: ';
      print_r($rule);
      echo 'OPTIONS: ';
      print_r($options);
      echo '_POST: ';
      print_r($_POST);
      echo '_GET: ';
      print_r($_GET);
      error_log(ob_get_clean());
      
      return $match;
    }