Home Forums Add-ons Options Page User role option / custom field Reply To: User role option / custom field

  • I would probably add a custom field to an options page for each user role that the client wants to set this for. I would name the fields something like


    where $user_role represents the name of each role.

    Then when you need to get the value you first get the user role of the current user and then you can get the discount with a single line of code

    $discount = get_field("discount_{$user_role}", 'options');