Add HTML Attributes To Anchor Tags In `wp_list_categories()` Function
The default walker used by wp_list_categories() (Walker_Category) has a hook (a filter hook) named category_list_link_attributes which you can use to add custom title and class (as well as other attributes like data-xxx) to the anchor/a tag (<a>) in the HTML list generated via wp_list_categories(). So for example, you can do something like: add_filter( ‘category_list_link_attributes’, ‘my_category_list_link_attributes’, … Read more