I found this solution
function jb_my_custom_job_details_fields($job_details_fields)
{
$i = 0;
foreach ($job_details_fields as &$field) {
if (isset($field['id']) && 'jb-job-type' === $field['id']) {
unset( $job_details_fields[$i] );
}
$i++;
}
return $job_details_fields;
}
add_filter('jb_job_details_metabox_fields', 'jb_my_custom_job_details_fields', 10, 1);
`
Can you please tell me if it is possible to simplify the code?
Hi @alexodiy
Sorry for the delay,
If you want to remove these fields only on the backend Add/Edit job screen it’s a proper hook and you could replace $i
to $key
inside foreach:
($job_details_fields as $key => &$field) {
and make unset:
unset( $job_details_fields[$key] );
Also please make sure that for the v1.2.0 you need to replace callback function for this AJAX action: wp_ajax_jb-validate-job-data
. There is validation for the job fields and if you need to remove required job data, please remove validation for this required data too.
Let me know if you have other questions or I may resolve this topic,
Best Regards!