nav_menu_item_title stripping most HTML

[ad_1]

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]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer