Site icon Hip-Hop Website Design and Development

HTML in Menu Objects disappear on save

I’ve created a menu that, as a substitute of plain textual content, must have icons. Sadly the “CSS Courses” possibility supplied by WP provides the category to the li relatively than the a so the icon will not be clickable if added there. Additionally, if I add a menu merchandise with out a title (as a result of my menus must be nothing however icons) the menu merchandise disappears fully when saving the menu.

To unravel this I’ve merely set the “Navigation Label” to <span class="icon-facebook" title="Fb"></span>. This works high quality and I’ve achieved it this manner for ages.

What I observed right this moment nevertheless is that if the consumer administrating the menu is not an admin, he’s unable to save lots of a menu merchandise with HTML in its label. This ends in the HTML being stripped, the “Navigation Label” being empty and thus WP eradicating that menu merchandise fully upon saving the menu.

Non-admins often should not have entry to the Menu Admin display screen, however I’ve given Editors that functionality utilizing:

$editorRole = get_role('editor');

if (!$editorRole->has_cap('edit_theme_options')) {
    $editorRole->add_cap('edit_theme_options');
}

Why does WP strip the HTML and the way can I forestall it from doing so?