Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This has been answered elsewhere, but I am having a problem with the code. I'm using this:

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;
}

This works fine except for when I first add the item to the menu. It then adds all the content from the post in the menu description area. Is there someway to avoid that? I can just delete the content after adding it the menu (and it works fine after that), but that is not very user friendly for my clients.

share|improve this question

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.