title: How to filter the sub-menu classname in WordPress navigation menus?
body: <p>In WordPress when using navigation menus, second-level menus are given the class <code>sub-menu</code>. For example:</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;
          &lt;a title="Page 1" href="/page-1/"&gt;Page 1&lt;/a&gt;
          &lt;ul class="sub-menu"&gt;
              &lt;li&gt;
                  &lt;a title="Sub page 1" href="/sub-page-1/"&gt;Sub page 1&lt;/a&gt;
              &lt;/li&gt;
              &lt;li&gt;
                  &lt;a title="Sub page 2" href="/sub-page-2/"&gt;Sub page 2&lt;/a&gt;
              &lt;/li&gt;
          &lt;/ul&gt;
      &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I'm using <a href="http://getbootstrap.com/" rel="nofollow noreferrer">Bootstrap 3</a> so need that classname to be <code>dropdown-menu</code>. My attempt so far has been to copy all of the <code>dropdown-menu</code> classes from bootstrap.css into my theme's style.css and change their names to <code>sub-menu</code>. This isn't a great approach because when I next upgrade Bootstrap, I'll need to check anything hasn't changed. </p>
  
  <p>My next thought was to filter the classname. Does WordPress provide a filter which will let me change this classname? </p>
  
  <p><strong>Update</strong></p>
  
  <p>I found a walker solution <a href="https://stackoverflow.com/a/5048792/1709033">here</a> which lets me change the <code>sub-menu</code> class.</p>
  
  <pre><code>class My_Walker_Nav_Menu extends Walker_Nav_Menu {
    function start_lvl(&amp;$output, $depth) {
      $indent = str_repeat("\t", $depth);
      $output .= "\n$indent&lt;ul class=\"my-sub-menu\"&gt;\n";
    }
  }
  </code></pre>
  
  <p>I'm pasting this directly into my theme's functions.php. This allows me to change the classname but my problem now is I get the following PHP debug notice:</p>
  
  <blockquote>
    <p>Strict Standards: Declaration of My_Walker_Nav_Menu::start_lvl()
    should be compatible with Walker_Nav_Menu::start_lvl(&amp;$output, $depth
    = 0, $args = Array) in /wp-content/themes/my-theme/functions.php
    on line 224</p>
  </blockquote>
  
  <p>Should I be pasting the walker directly into my theme's functions.php? Where am I going wrong?</p>