title: What does "array must have exactly two members" mean?
body: <p>I am trying to set up a custom walker for my wordpress menu. Its purpose is to allow me to add php code to the menu links as I could with text and images like this:</p>
  
  <pre><code>&lt;a href="http://mcadrives.com/?ref=&lt;?PHP code goes here?&gt;"&gt;
  </code></pre>
  
  <p>The php coding I have been using on every hyperlink and image is this:</p>
  
  <pre><code>&lt;a href="http://mcadrives.com/?ref=
      &lt;?php
         if (!empty ( $_SERVER['QUERY_STRING'])){
           echo substr($_SERVER['QUERY_STRING'],4); }
         else{ 
           echo 'mhammonds'; }
      ?&gt;&gt;
  </code></pre>
  
  <p>I added this to my functions.php file:</p>
  
  <pre><code>class Query_Nav extends Walker_Nav_Menu
  {
      function start_el( &amp;$output, $item, $depth = 0, $args = array(), $id = 0 ) {
          global $wp_query;
          $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
  
          $class_names = $value = '';
  
          $classes = empty( $item-&gt;classes ) ? array() : (array) $item-&gt;classes;
          $classes[] = 'menu-item-' . $item-&gt;ID;
  
          $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
          $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
  
          $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item-&gt;ID, $item, $args );
          $id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
  
          $output .= $indent . '&lt;li' . $id . $value . $class_names .'&gt;';
  
          $attributes  = ! empty( $item-&gt;attr_title ) ? ' title="'  . esc_attr( $item-&gt;attr_title ) .'"' : '';
          $attributes .= ! empty( $item-&gt;target )     ? ' target="' . esc_attr( $item-&gt;target     ) .'"' : '';
          $attributes .= ! empty( $item-&gt;xfn )        ? ' rel="'    . esc_attr( $item-&gt;xfn        ) .'"' : '';
  
          //ADD YOUR PHP HERE TO DETERMINE WHATEVER IT IS YOU NEED FOR YOUR LINK
          if ( ! empty ( $_SERVER['QUERY_STRING'] ) ) {
              $addedStuff = '?ref=' . substr( $_SERVER['QUERY_STRING'], 4 );
              }else { 
                      $addedStuff = '?ref=mhammonds';
  }
          $attributes .= ! empty( $item-&gt;url )        ? ' href="'   . esc_attr( $item-&gt;url.$addedStuff) .'"' : '';
          ////////////////////
  
          $item_output = $args-&gt;before;
          $item_output .= '&lt;a'. $attributes .'&gt;';
          $item_output .= $args-&gt;link_before . apply_filters( 'the_title', $item-&gt;title, $item-&gt;ID ) . $args-&gt;link_after;
          $item_output .= '&lt;/a&gt;';
          $item_output .= $args-&gt;after;
  
          $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
      }
  }
  </code></pre>
  
  <p>and I added this walker 'new Query_Nav' to my nav-menu-template.php:</p>
  
  <pre><code>function wp_nav_menu( $args = array() ) {
      static $menu_id_slugs = array();
  
      $defaults = array( 'menu' =&gt; '', 'container' =&gt; 'div', 'container_class' =&gt; '', 'container_id' =&gt; '', 'menu_class' =&gt; 'menu', 'menu_id' =&gt; '',
      'echo' =&gt; true, 'fallback_cb' =&gt; 'wp_page_menu', 'before' =&gt; '', 'after' =&gt; '', 'link_before' =&gt; '', 'link_after' =&gt; '', 'items_wrap' =&gt; '&lt;ul id="%1$s" class="%2$s"&gt;%3$s&lt;/ul&gt;',
      'depth' =&gt; 0, 'walker' =&gt; 'new Query_Nav()', 'theme_location' =&gt; '' );
  </code></pre>
  
  <p>I was then informed by a WARNING that class 'new Query_Nav()' is not found on Line 660, so I added it like so:</p>
  
  <pre><code>function walk_nav_menu_tree( $items, $depth, $r ) {
      $walker = ( empty($r-&gt;walker) ) ? new Walker_Nav_Menu : $r-&gt;walker;
      $args = array( $items, $depth, $r );
  
      return call_user_func_array( array( $walker, 'walk', 'new Query_Nav()'), $args );
  </code></pre>
  
  <p>Now I have another WARNING stating:</p>
  
  <pre><code>call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in /home/ballaboy258/public_html/wp-includes/nav-menu-template.php on line 660
  </code></pre>
  
  <p>I have removed each one and neither has solved the problem. If I remove $walker, then 'walk' is not found. If I remove 'walk', then 'new Query_Nav()' is not found. If I remove 'new Query_Nav()', again, "new Query_Nav()' is not found. It doesn't make any sense. 
  Did I miss a step, or is my syntax wrong? I'm confused and I can't find anything on the web to help me.</p>