How to get the element ID from new menu list that added with add_filter()?

Question

I wanna ask how to get the element ID (with javascript) from new menu list that added with add_filter() ?

So i’m trying to make a plugin that insert new menu list with add filter like this :

add_filter( 'wp_nav_menu_items', $new_menu_list, $nav);

i’ve tried to get the id using javascript with click event listener. but the event listener is not working.

But when i put same code hardcoded in template, it’s working fine. so i think this is happens because of the add_filter things. but i dont know, i’m not sure, i really new to this.

what i’ve missed? any solutions? thank you.

*sorry for bad english.

0
CreamerCode 4 weeks 0 Answers 7 views 0

Leave an answer