4

I added descriptions to my menus using this post, Menu items description? Custom Walker for wp_nav_menu(). However I need to be able to use html tags and WordPress is stripping them out. Can anyone help?

2 Answers 2

3

You can remove the filter by adding this to your functions.php file:

remove_filter('nav_menu_description', 'strip_tags');
2

In new wordpress we need add some mojo:

remove_filter('nav_menu_description', 'strip_tags');
add_filter( 'wp_setup_nav_menu_item', 'cus_wp_setup_nav_menu_item' );
function cus_wp_setup_nav_menu_item($menu_item) {
                $menu_item->description = apply_filters('nav_menu_description',  $menu_item->post_content );
                return $menu_item;
}
1
  • This works, but when I add new page, it will put the entire content in it. Any way to circumvent this?
    – dingo_d
    Commented Oct 3, 2014 at 10:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.