title: How to clean up menu li by removing all attributes, but keep `class="active"` for the current menu item?
body: <p>Using wordpress, making a simple menu; unordered list with li, and no attributes present to make the HTML look cleaner. However, the active li (depending on the page the user is on) should have a <code>class="active"</code>.</p>
  
  <p>I've tried changing the priority parameter of the <code>add_filter</code> in <code>functions.php</code>.</p>
  
  <p>Here's the first block of code that removes the class attribute.</p>
  
  <pre><code>add_filter('nav_menu_css_class', 'my_css_attributes_filter', 10, 1);
  function my_css_attributes_filter($var) {
      return is_array($var) ? array() : '';
  }
  </code></pre>
  
  <p>Here's the 2nd block, which has the same hook, <code>nav_menu_css_class</code>, and the same priority parameter, <code>10</code>, as the first block.</p>
  
  <pre><code>add_filter('nav_menu_css_class' , 'special_nav_class' , 10 , 2);
  function special_nav_class($classes, $item){
      if( in_array('current-menu-item', $classes) ){
                      $classes[] = 'active ';
      }
      return $classes;
  }
  </code></pre>
  
  <p>I would like to know how to make my li look like this when on the active page:</p>
  
  <pre><code>  &lt;li class="active"&gt;&lt;/li&gt;
  </code></pre>
  
  <p>If I remove the <code>add_filter('nav_menu_css_class', 'my_css_attributes_filter', 10, 1);</code>, the <code>active</code> class is present, but with all the other mess: </p>
  
  <pre><code>&lt;li class="menu-item menu-item-type-post_type_archive menu-item-object-news current-menu-item menu-item-42 active"&gt; &lt;/li&gt;
  </code></pre>