title: how to add data attribute to a <li> element in wordpress nav menu
body: <p>I'm using fullpage.js on a wordpress site and would like to use one of it's function wicht is to add a class on a li. But to do this you need to add the data attribute data-menuanchor .</p>
  
  <p>I have seen this: </p>
  
  <pre><code>add_filter( 'nav_menu_link_attributes', 'my_nav_menu_attribs', 10, 3 );
  function my_nav_menu_attribs( $atts, $item, $args )
  {
    // The ID of the target menu item
    $menu_target = 113;
  
    // inspect $item
    if ($item-&gt;ID == $menu_target) {
      $atts['data-menuanchor'] = 's1';
  
    }
    return $atts;
  }
  </code></pre>
  
  <p>It works excepts that it adds the attribute to the a tag and need it to be on the li tag. </p>
  
  <p>Also, if I want to do it to all the items on the menu. Do I need to do this function for all the items? And I suppose I have to rename the function each time?</p>
  
  <p>Thanks</p>