Ask your WordPress questions! Pay money and get answers fast! (more info)

Sync Wp role With Ultimate member plugin roles on new users WordPress


Hi there,

I am creating Wp user from APi using:

I want to send a double opt-in to validate email and sync a role from WP to Ultimate member WP plugin:


There is actually a way to sync UM role into Wp role for new users:

add_action('um_after_user_is_approved', 'sync_um_and_wp_role', 99 );
function sync_um_and_wp_role( $user_id ) {
$role = get_user_meta( $user_id, 'role', true);
if ( $role == 'member' ) {
$wp_user_object = new WP_User( $user_id );
$wp_user_object->set_role( 'student' );



I need all the way around!!

I mean "Sync Wp role into Ultimate Member Role", so when push user from API-user-plus, and then send double opt in to validate this user and sync role into Ultimate member plugin

Ultimate Member has API and codex show way apparently to set role:

$ultimatemember->user->set_role( $role );


Kindly post code to try it thanks and explain in which file needs to be inserted (functions.php), I am running My Custom Functions plugin.


Answers (0)

No answers yet.