Hi, I am trying to find a way to hide a field in a search form based on user role (Wordpress roles).
This is what I came up with so far:
add_filter (‘bps_before_search_form_filter’, ‘hide_fields’, 10, 1); // note, i made that filter name up…
function hide_fields ($field_ids){
global $current_user;
$user_roles = $current_user->roles;
if (in_array($user_roles, ‘subscribe’){
unset($field_ids[‘id number of field you want to remove’]);
}
return $field_ids;
}