-
-
Save helgatheviking/497b12b18d14db4d0d8bb917fb08a737 to your computer and use it in GitHub Desktop.
@photocurio Fair. I'd try adding additional parameters, var dumping the new params and see what they are:
function kia_custom_fields( $item_id, $item, $args, $menu_id ) {
var_dump($args);
var_dump($menu_id);
}
add_action( 'wp_nav_menu_item_custom_fields', 'kia_custom_fields', 10, 4 );
You might get lucky and have the menu location in the $args
array.
Neat example. Thank you!
How would I actually show an ACF custom field such as "Location" (which is the address for the Location) in addition to the post title In this area of Wordpress menus??? I need to show the Home Listings location not just the Post Title which is a basic name of the home. Any ideas would be helpful...Then on the frontend in the drop down menu, it would say for example: Northwood • 555 TheCity, State Zip
Sorry @whynotadv I don't know the answer to that. Does the nav_menu_item_title
not apply in the admin?
Thanks @helgatheviking for replying. It might, but I'm not sure. Looks like probably have to use is_admin () https://developer.wordpress.org/reference/functions/is_admin/
I think this is something close, but not sure it's exactly what I'm looking for???? https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/
Again, not sure if the wp_get_nav_menu_items
in run at this point in the admin either... you'll have to test.
@helgatheviking, its true the fields can be overlooked, but if you have a lot of menus, and some menus dedicated for specific purposes, and a lot of data, things can get messy. I'll post if I find a solution.