WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Used code I found on css tricks to remove the li tags from wp_nav_menu.

$menu_parameters = array(
'container'       => false,
'echo'            => false,
'items_wrap'      => '%3$s',
'depth'           => 0,

<?php echo strip_tags(wp_nav_menu( $menu_parameters ), '<a>' ); ?>

I placed $menu_parameters in functions.php and called it in my index file and everything was working great until I separated my index files into their appropriate php files. After I moved the strip_tag function into the header.php and then called it using get_header, the nav now falls back to the wp default. Any ideas?

share|improve this question
Are you familiar with the concept of variable scope in PHP? – Milo Aug 19 '14 at 20:26
This is not how you get the links, you are wasting resources to build the li elements you then try to throw away. Use a custom walker instead. – toscho Aug 19 '14 at 20:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.