We ended up doing a workaround by using the nav_menu_item_title hook (our function is included below).
By adding a class to the wordpress menu item in the format like this “ico-fas-user”, the function will prepend the correct span to the title and the alternate naming of the class on the menu item means it will have no effect in the wrong place.
/**
* Add icons to custom nav
*/
function my_nav_menu_item_title( $title, $item, $args, $depth ){
foreach($item->classes as $class) {
if(substr($class, 0, 4) == 'ico-') {
$class = str_replace(array('far-', 'fas-', 'fal-', 'fab-'), array('far fa-', 'fas fa-', 'fal fa-', 'fab fa-'), substr($class, 4));
$icon = '<span class="'.$class.'"></span>';
$title = $icon.$title;
break;
}
}
return $title;
}
add_filter('nav_menu_item_title','my_nav_menu_item_title',10,4);