Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Dan Zakirov

    (@alexodiy)

    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?

    Plugin Author Mykyta Synelnikov

    (@nsinelnikov)

    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!

    Thread Starter Dan Zakirov

    (@alexodiy)

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to disable – hide unnecessary fields’ is closed to new replies.