Support » Fixing WordPress » duplicate subscriber roles

  • I was messing with roles a while back, and somehow I ended up with 2 separate subscriber roles. One is capitalized and one is not. For example, this is how they look:

    subscriber
    Subcscriber

    Both have the same number a users.

    I’d like to remove the 2nd subscriber role (I believe the one that is capitalized is the one that needs to be removed).

    Problem is when I try to do this, using a plugin like User Role Editor, it won’t let me delete the extra role. Even though it’s a duplicate role, I can’t delete it – maybe because it says “Subscriber”

    Any suggestions on how to delete the second, unneeded role?

    Thanks for any help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Both roles that you have specified are different (check spelling).

    To remove user role use put bellow code in function.php

    //check if role exist before removing it
    if( get_role(‘Subcscriber’) ){
    remove_role( ‘Subcscriber’ );
    }

    once your role is removed, delete above code from your function.php file

    Sorry about that. I got the spelling wrong in my question, but in WordPress, the spelling is actually the same on the 2 roles, with the exception that one is capitalized and one if not:

    Subscriber
    subscriber

    (those were actually copied and pasted from my WordPress roles)

    Is is still safe to use that function (to remove the uppercase “Subscriber” role)? I’m concerned about messing something up. Thanks for any suggestions.

    If you have existing users assigned with role ‘Subscriber’, they will loose their roles and will be assigned as None.

    https://prnt.sc/hzhd7k

    //check if role exist before removing it
    if( get_role('subscriber') ){
          remove_role( 'subscriber' );
    }

    I would suggest, please take backup of your database, to be on safer side.

    I believe the role that needs to be removed is the capitalized role:

    Subscriber

    I wanted the un-capitalized role to stay the same.

    Based on what you’ve said, I’m thinking it’s safer to just leave it alone. I don’t want to take a chance of removing users from the needed “subscriber” role.

    I guess leaving the duplicate role as it is won’t hurt anything?

    Thanks for all of the help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘duplicate subscriber roles’ is closed to new replies.