Home Forums General Issues Add additional role to user Reply To: Add additional role to user

  • Thanks John worked it out from your input.

    Here’s the code if anyone else needs help as I looked around for quite a while before raising a ticket.

    add_action (‘acf/save_post’, ‘add_role_on_selection’);

    function add_role_on_selection ($post_id) {

    // Get newly saved values.
    $values = get_fields( $post_id );

    // Check the new value of a specific field.
    $selected = get_field(‘stall_catergory’, $post_id);
    $user = wp_get_current_user();
    if( $selected == ‘general’) {
    if( $selected == ‘food’) {
    if( $selected == ‘hot food’) {