• Resolved ermWP

    (@ermwp)


    I would like to create a UM role via code if it does not already exist on the site when I install a custom plugin. How can I create a UM role via code?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @ermwp

    You can check this wp.org doc to create a new role:
    https://developer.wordpress.org/reference/functions/add_role/

    Regards,

    Thread Starter ermWP

    (@ermwp)

    Thank you for the reply. Will that make it a UM custom role? I know how to make a WP role. How do I programmatically make a custom UM role?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @ermwp

    When you create a role with add_role it should create the UM Role. Try running this code: add_role( "um_test_role","UM Test Role", array() );

    Once the role is added, go to WP Admin > Ultimate Member > User Roles > see “UM Test Role”.

    Regards,

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hey there!

    This thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Please feel free to re-open this thread by changing the Topic Status to ‘Not Resolved’ if any other questions come up and we’d be happy to help. 🙂

    Regards,

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Create a Role Programmatically’ is closed to new replies.