Code goes to your active theme’s functions.php file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | function wpcrcustom_remove_user_assignment_sections(){ // get current user roles $current_user = wp_get_current_user(); $user_roles = $current_user ->roles; // remove assignment sections from employee if (in_array( 'wpcargo_employee' , $user_roles )){ // remove assign client section remove_action( 'wpcr_after_receiving_form_fields' , 'wpcr_client_receiving_form_fields' ); // remove assign agent section remove_action( 'wpcr_after_receiving_form_fields' , 'wpcr_agent_receiving_form_fields' ); // remove assign employee section remove_action( 'wpcr_after_receiving_form_fields' , 'wpcr_employee_receiving_form_fields' ); // remove assign driver section remove_action( 'wpcr_after_receiving_form_fields' , 'wpcr_pod_receiving_form_fields' ); } } add_action( 'init' , 'wpcrcustom_remove_user_assignment_sections' , 20); |
Before hook application:
After hook application: