Hello @koolmind
There is some syntactical mistake in the above filter.
Kindly check this below filter:
add_filter( 'hfe_nav_menu_attrs', 'add_role_attribute_to_menu' );
function add_role_attribute_to_menu( $atts ) {
$atts .= ' role=' . 'button';
return $atts;
}
Kindly refer to the screenshot( at our end )
Please let us know in case of any further help.
Regards,
Rahul.
Thank you very much!
Is there a way to apply the filter only on first level menu items?
Can I only work on $atts variable, or there’s the chance to get also the a $item variable to work with?
Thanks again.
Hello @koolmind
It won’t be possible to apply the attributes to the first level item only.
Also, only attributes can be changed, not the items.
Please let us know in case of any further help.
Regards,
Rahul.