Title: Errors after removing fields
Last modified: August 21, 2016

---

# Errors after removing fields

 *  Resolved [David Mottershead](https://wordpress.org/support/users/motty/)
 * (@motty)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/)
 * Hi
 * I’ve removed all the company fields, the job location, and the application using
   the following code:
 * add_filter( ‘submit_job_form_fields’, ‘custom_submit_job_form_fields’ );
 *     ```
       function custom_submit_job_form_fields( $fields ) {
       	unset( $fields ['company'] );
       	unset( $fields ['job']['job_location'] );
       	unset( $fields ['job']['application'] );
       	return $fields;
       }
       ```
   
 * I got this from here [https://gist.github.com/mikejolley/9476823](https://gist.github.com/mikejolley/9476823)
 * I’ve got WP_DEBUG set to true and am being notified of errors by the WP Error
   Fix plugin. Examples are:
 * Undefined index: company
    /wp-content/plugins/wp-job-manager/includes/forms/class-
   wp-job-manager-form-submit-job.php(569) Undefined index: job_location /wp-content/
   plugins/wp-job-manager/includes/class-wp-job-manager-geocode.php(25) Undefined
   index: application /wp-content/plugins/wp-job-manager/includes/forms/class-wp-
   job-manager-form-submit-job.php(567)
 * I presume it is because these functions are trying to get this data and it is
   throwing a warning because the fields don’t exist any more.
 * Any way to solve?
 * Thanks
 * [https://wordpress.org/plugins/wp-job-manager/](https://wordpress.org/plugins/wp-job-manager/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143226)
 * I don’t think you are on the latest release – I know that unsetting company should
   cause no notices as I’ve used it a few times.
 * Are you using 1.13?
 *  Thread Starter [David Mottershead](https://wordpress.org/support/users/motty/)
 * (@motty)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143237)
 * Hi
 * Thanks for looking into it. I’m definitely using 1.13. They are only warnings
   I believe so you won’t get any errors without WP Debug turned on. They are being
   reported by the WP Error Fix plugin when a job is submitted.
 * WP Error Fix is reporting the following. The number in brackets is the line number.
 * Undefined index: application
    /wp-content/plugins/wp-job-manager/includes/forms/
   class-wp-job-manager-form-submit-job.php(567) 2014-07-30 17:28:01 (1) new Undefined
   index: company /wp-content/plugins/wp-job-manager/includes/forms/class-wp-job-
   manager-form-submit-job.php(569) 2014-07-30 17:28:01 (1) new Undefined index:
   company /wp-content/plugins/wp-job-manager/includes/forms/class-wp-job-manager-
   form-submit-job.php(570) 2014-07-30 17:28:01 (1) new Undefined index: company/
   wp-content/plugins/wp-job-manager/includes/forms/class-wp-job-manager-form-submit-
   job.php(571) 2014-07-30 17:28:01 (1) new Undefined index: company /wp-content/
   plugins/wp-job-manager/includes/forms/class-wp-job-manager-form-submit-job.php(
   572) 2014-07-30 17:28:01 (1) new Undefined index: company /wp-content/plugins/
   wp-job-manager/includes/forms/class-wp-job-manager-form-submit-job.php(573) 2014-
   07-30 17:28:01 (1) new Undefined index: company /wp-content/plugins/wp-job-manager/
   includes/forms/class-wp-job-manager-form-submit-job.php(579) 2014-07-30 17:28:
   01 (1) new Undefined index: company /wp-content/plugins/wp-job-manager/includes/
   forms/class-wp-job-manager-form-submit-job.php(580) 2014-07-30 17:28:01 (1) new
   Undefined index: company /wp-content/plugins/wp-job-manager/includes/forms/class-
   wp-job-manager-form-submit-job.php(581) 2014-07-30 17:28:01 (1) new Undefined
   index: company /wp-content/plugins/wp-job-manager/includes/forms/class-wp-job-
   manager-form-submit-job.php(582) 2014-07-30 17:28:01 (1) new Undefined index:
   company /wp-content/plugins/wp-job-manager/includes/forms/class-wp-job-manager-
   form-submit-job.php(583) 2014-07-30 17:28:01 (1) new Undefined index: job_location/
   wp-content/plugins/wp-job-manager/includes/class-wp-job-manager-geocode.php(25)
   2014-07-30 17:28:01 (1) new
 * Thanks
 *  Thread Starter [David Mottershead](https://wordpress.org/support/users/motty/)
 * (@motty)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143239)
 * Not sure if this helps but here is the full code I’ve added to functions:
 *     ```
       global $job_manager;
   
       remove_action( 'job_manager_application_details_email', array( $job_manager->post_types, 'application_details_email' ) );
       add_action( 'job_manager_application_details_email', 'my_job_application_form' );
   
       function my_job_application_form () {
       	$author_email_addy = get_the_author_meta( 'user_email' );
       	$author_first_name = get_the_author_meta ('first_name');
       	gravity_form($id_or_title='Apply For Job', $display_title=true, $display_description=true, $display_inactive=false, $field_values = array('author_email'=> $author_email_addy,'author_greeting'=>$author_first_name), $ajax=false);
       }
   
       add_filter( 'submit_job_form_fields', 'custom_submit_job_form_fields' );
   
       function custom_submit_job_form_fields( $fields ) {
       	unset( $fields ['company'] );
       	unset( $fields ['job']['job_location'] );
       	unset( $fields ['job']['application'] );
       	return $fields;
       }
   
       add_filter( 'submit_job_form_fields', 'frontend_add_new_fields' );
   
       function frontend_add_new_fields( $fields ) {
         $fields['job']['job_region'] = array(
           'label' => 'Job Region',
           'type' => 'select',
           'required' => true,
           'options' => array ( 0 => 'Choose a region', 'Bermuda' => 'Bermuda', 'Cayman Islands' => 'Cayman Islands', 'Other' => 'Other' ),
           'placeholder' => '',
           'priority' => 3
         );
         return $fields;
       }
   
       add_action( 'job_manager_update_job_data', 'frontend_add_region_field_save', 10, 2 );
   
       function frontend_add_region_field_save( $job_id, $values ) {
         update_post_meta( $job_id, '_job_region', $values['job']['job_region'] );
       }
   
       add_filter ('job_manager_job_listing_data_fields','admin_add_new_fields');
   
       function admin_add_new_fields ($fields) {
       	$fields['_job_region'] = array(
       		'label' => __( 'Job Region', 'job_manager' ),
       		'type' => 'select',
           	'options' => array ( 0 => 'Choose a region', 'Bermuda' => 'Bermuda', 'Cayman Islands' => 'Cayman Islands', 'Other' => 'Other' ),
       		'placeholder' => '',
       		'description' => ''
       	);
       	return $fields;
       }
       ```
   
 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143351)
 * These notices should be fixed in the next update.
 * Thanks
 *  Thread Starter [David Mottershead](https://wordpress.org/support/users/motty/)
 * (@motty)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143352)
 * Thanks ever so much Mike.
 * So my code is fine????
 * Thanks for writing the plugin. It is truly one of the best.
 * A default salary field would make it out of this world. Especially if it had 
   the ability to set a currency, rate (fixed and range), plus time period (hour,
   month, year).
 * Regards
 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143355)
 * Your code looks ok – there are just some cases where those fields were not checked
   to see if they exist.
 * Just be careful about removing the ‘application’ field – you’ll disable the ability
   to let people apply, or use add-ons which handle applications too.
 *  Thread Starter [David Mottershead](https://wordpress.org/support/users/motty/)
 * (@motty)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143358)
 * Thanks
 * Regarding removing the application field.
 * I’m inserting a Gravity form on the single jobs page. Then I’m pulling the email
   address of the post author into a hidden field. Then using this to send any job
   submissions to the post author’s email address.
 * So I don’t believe I need the application field.
 *  Plugin Author [Mike Jolley](https://wordpress.org/support/users/mikejolley/)
 * (@mikejolley)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143383)
 * That should be fine, so long as the apply plugin you are using still shows up.
   Not all hooks are fired when application is missing.
 *  [tripflex](https://wordpress.org/support/users/tripflex/)
 * (@tripflex)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143417)
 * That is true, if `WP_Debug` is disabled those warnings will not show (which it
   should always be disabled in production, at LEAST disable `WP_Debug_Display`)
 * You can get a free beta tester license for my field editor plugin that should
   remove those warnings from showing as even if it’s disabled I still have the 
   field a part of the array so it’s just a blank value … get one here:
 * [https://plugins.smyl.es/wp-job-manager-field-editor/](https://plugins.smyl.es/wp-job-manager-field-editor/)

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Errors after removing fields’ is closed to new replies.

 * ![](https://ps.w.org/wp-job-manager/assets/icon-256x256.gif?rev=2975257)
 * [WP Job Manager](https://wordpress.org/plugins/wp-job-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-job-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-job-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-job-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-job-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-job-manager/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [tripflex](https://wordpress.org/support/users/tripflex/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/errors-after-removing-fields/#post-5143417)
 * Status: resolved