I am trying to insert some HTML into the title of menu items, however from my simple tests it does not appear to be working. I am running this code in my functions.php file
function show_menu_item_desc( $title, $item ) { if( is_object( $item ) && isset( $item->ID ) ) { $title=”<span class=’blabla’>TEST <br> TEST</span>”; } return $title; } add_filter( ‘nav_menu_item_title’, ‘show_menu_item_desc’, 10, 2 );
However it then displays as
<span>TEST TEST</span>
However from reading the [documentation]) on the wordpress website for the nav\_menu\_item\_title filter, the example includes HTML classes. So i am not sure why its being stripped.
[ad_2]