Issue Description
If you’ve created a custom user role and then made changes to the capabilities, sometimes the changes aren’t reflected in the logged in view.
Logging out and logging in doesn’t do the trick, what do you do?!
How to Fix the Issue
When creating the user role in code, it saves the details to the database, this means that the only way to ‘refresh’ the role changes is to nuke the previous settings and re-instate them.
Simply adding the following code snippet before creating the user role will remove the previous settings and create the role with the new ones.
Fixed Code Snippets
remove_role( 'ROLE_NAME' );