I can manage this in the wordpress files but it will be overwritten in the next update. How can i code this in the child theme functions or can i overwrite the wp_nav_menu.php file in the child theme?
/**
* Filter a menu item's title.
*
* @since 4.4.0
*
* @param string $title The menu item's title.
* @param object $item The current menu item.
* @param array $args An array of {@see wp_nav_menu()} arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$title = apply_filters( 'nav_menu_item_title', $title, $item, $args, $depth );
$item_output = $args->before;
$item_output .= '<a'. $attributes .'><span>'; //NOTE THE SPAN IS ADDED HERE
$item_output .= $args->link_before . $title . $args->link_after;
$item_output .= '</span></a>'; //AND HERE
$item_output .= $args->after;
Thank you in advance!