php - str_replace wordpress menu -
i have menu of following hyperlinks. 1) our work 2) clients 3) 4) contact my question is, how can prevent following code not replace li in 'clients'? it outputs 'caents', although need stop outputting <li> tags in menu. <nav> <?php // first let's our nav menu using regular wp_nav_menu() function special parameters $cleanmenu = wp_nav_menu( array( 'container' => false, // div outside menu ul, don't need 'depth' => 0, 'sort_column' => 'menu_order, post_title', 'echo' => false, // don't display yet ) ); // find closing bracket of each li , opening of link, instances of "li" $find = array('><a','li'); // replace former nothing (a.k.a. delete) , latter "a" $replace = array('','a'); echo str_replace( $find, $replace, $cleanmenu ); ?> </nav> i wouldn't recommend parsing html way. take time , lea...