I know I need to use the function for what I want to do, but I have very little exposure to it so need some help.
On the wordpress menu system (wp 3.0+), they add a hell of a lot of extra code which I don’t need.
I have worked out how to replace the divs, and the ul around the menu, but the li has a load of classes and an id which I don’t need / want.
Below is the code I have used to try and remove the code, but not having any luck
function add_menuclass($liclass) {
return preg_replace( array( '#^<li class="menu-item menu-item-type-post_type"[^>]*>#' ), '<li>', $menu );
}
add_filter('wp_page_menu','add_menuclass');
</li>bump, anyone know what I am doing wrong?
Gareth_Gillman said
bump, anyone know what I am doing wrong?

Hi Gareth,
I guess you must change the $menu with $liclass
function add_menuclass($liclass) {
return preg_replace( array( '#^<li class="menu-item menu-item-type-post_type"[^>]*>#' ), '<li>', $liclass );
}
add_filter('wp_page_menu','add_menuclass');
</li>
hope it helps.
Tolga
not really.
he was talking about wp 3.0+ menu, which means wp_nav_menu not wp_page_menu
for wp_nav_menu you need to write walker (extend it) so you get rid of that extra code
yeah, you’re right! i didn’t see the wp_page_menu. But i’ve used add_filter without walker, it works!
