add_filter('job_bm_job_submit_errors', 'job_bm_job_submit_errors_29072019', 90,2); function job_bm_job_submit_errors_29072019($error, $post_data){ if(empty($post_data['custom_form_field'])){ $error->add( 'custom_form_field', __( 'ERROR: Field is empty.', 'job-board-manager' ) ); } return $error; }
Remove errors
You can remove error message if you remove required fields.
add_action('job_bm_job_submit_form','remove_some_fields_20200512', 2); function remove_some_fields_20200512(){ remove_action('job_bm_job_submit_form','job_bm_job_submit_form_company_name',45); remove_action('job_bm_job_submit_form','job_bm_job_submit_form_location',45); remove_action('job_bm_job_submit_form','job_bm_job_submit_form_address',45); } add_filter('job_bm_job_submit_errors', 'job_bm_job_submit_errors_29072019', 90,2); function job_bm_job_submit_errors_29072019($error, $post_data){ // Get errors $errors = isset($error->errors) ? $error->errors : array(); // Remove errors unset($errors['job_bm_company_name']); unset($errors['job_bm_location']); unset($errors['job_bm_address']); // Assign/update errors $error->errors = $errors; return $error; }