title: Adding div after WordPress submenu items
body: <p>I am trying to add a div after any submenu items in a WordPress menu. I am working on the following code in the functions.php file:</p>
  
  <pre><code>add_filter( 'nav_menu_link_attributes', 'SubMenuCheck', 10, 3 );
  function SubMenuCheck( $atts, $item, $args ) {
    if (in_array('menu-item-has-children', $item-&gt;classes)) {
      $args-&gt;after = '&lt;div class="click"&gt;+&lt;/div&gt;';
    }
    return $atts;
  }
  </code></pre>
  
  <p>The code above adds the new div <code>&lt;div class="click"&gt;+&lt;/div&gt;</code>but keeps applying it to all parent and child items after the first 'menu-item-has-children' class:</p>
  
  <p><a href="https://i.stack.imgur.com/VMvqF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VMvqF.jpg" alt="menu issue example"></a></p>
  
  <p>Does anyone know why this is repeating?... I only want the div to display for items with the <code>menu-item-has-children</code> class.</p>
  
  <p>Thanks</p>