allow arbitrary HTML attributes on <a> produced by Walker_Page
|Reported by:||pbiron||Owned by:|
Walker_Nav_Menu currently allows arbitrary HTML attributes to be added to the <a> tags it generates via the nav_menu_link_attributes filter.
It would be useful to do the same in Walker_Page (i.e., add a page_menu_link_attributes filter).
My immediate need is to add "aria-current='page'" to the <a> tag for the current page in the output generated by wp_page_menu(). But other potential uses would be to add "target='_blank'", etc.
My current workaround is to subclass Walker_Page, duplicating Walker_Page::start_el() except for adding "aria-current='page'" when $page->ID === $current_page. But that is far from ideal...as I will have to track changes to Walker_Page::start_el() in future released and update my subclass appropriately.
There may be other places across core where a similar filter would also be useful (e.g., Walker_Category) and I'd be willing to look for those other places if my proposed addition to Walker_Page is accepted as a good idea.