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;
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.