Get archives as array
If you look at wp_get_archives() you will notice that the link is generated by get_archives_link(). That function supplies a filter that will allow you to replace the parens. This is fairly crude but does work. function archive_link_wpse_183665($link) { $pat=”|\(([^)])\)</li>|”; // preg_match($pat,$link,$matches); // var_dump($matches); $link = preg_replace($pat,'[$1]’,$link); return $link; } add_filter( ‘get_archives_link’, ‘archive_link_wpse_183665’ );