Add classes to menu link tags.
<?php
/**
* Add classes to menu link tags.
*/
add_filter('nav_menu_link_attributes', function($atts, $menu_item) {
if (empty($atts['class'])) {
$atts['class'] = 'menu-link';
} else {
$atts['class'] .= ' menu-link';
}
if (in_array('menu-item-has-children', $menu_item->classes)) {
$atts['class'] .= ' menu-popup';
}
return $atts;
}, 10, 2);
?>
functions.php