Ok, in case anyone else experiences a similar issue in defining a custom user role, it seems I’ve managed to sort the issue by following these instructions in the WordPress Codex:
If you are defining a custom role, and adding capabilities to the role
using add_role(), be aware that modifying the capabilities array and
re-executing add_role() will not necessarily update the role with the
new capabilities list. The add_role() function short-circuits if the
role already exists in the database.The workaround in this case is to precede your add_role() call with a
remove_role() call that targets the role you are adding.This is for development only. Once you have nailed down your list of
capabilities, there’s no need to keep the remove_role() code, though
there is, in fact, no harm in doing so.
So, in my case, I added the following before add_role()
:
if ( get_role('dashboard_admin') ) {
remove_role('dashboard_admin');
}