Support » Plugin: WP Job Manager » Default values for custom fields and multiselect types

  • Resolved Rick


    There seems to be an issue where default values for custom fields are not being displayed. For example when I clicked Edit resume and submitted a value and an error was fired it did not keep my posted value. I put this in the custom field:

    $fields['resume_fields']['candidate_address'] = array(
    	'label' => __('Address', 'wp-job-manager-resumes'),
    	'type' => 'text',
    	'required' => 1,
    	'placeholder' => 'Your full address',
    	'priority' => 1.1,
    	'value' => isset($_POST['candidate_address']) ? $_POST['candidate_address'] : get_user_meta($user_id, 'addr1', 1)

    As you can see it should put the post data in the value, but it doesn’t. I even set it as static and it still showed as a blank value. Which means if someone submits a bunch of data and an error is thrown, everything they submitted is gone 🙁

    Also the get_posted_field() method in class-wp-resume-manager-form-submit-resume.php is not checking for multiselect fields, ie an array which then means that an error is thrown. The multiselect-form.php template also doesn’t have a place for a description, which would be nice. I overrode it in mine, but it seems like most people would want to put the instructions of how to multiselect on the different PC platforms.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mike Jolley


    Multi selects are getting some enhancements in 1.14 – if you want to contribute to this, do so via github (

    For multiselect, ‘value’ needs to be an array. I’d suggest var_dumping your post data to see what is being posted, and whether or not its an array.

    In your function above, where you have:

    'value' => isset($_POST['candidate_address']) ? $_POST['candidate_address'] : get_user_meta($user_id, 'addr1', 1)

    You may also want to var_dump the post to see if its there or not. I don’t see anything wrong there assuming it gets posted. If this is an ‘edit’ it won’t work because you are falling back to user meta rather than the data in the resume.

    Ah ok, Ill look into contributing. Haven’t contributed before through github so a little nervous 🙂

    I found out the problem was that there was a ™ in the options and it was not holding those values. As soon as I removed the ™ then it worked. I might look into that also. That might be a bit harder to fix.. not sure yet.

    Ok yeah the value was for “edit”. Shouldn’t it still use value though since like I said, if you posted the data, and since it’s not javascript validation, you lose everything you just typed if there is an error?

    Plugin Author Mike Jolley


    Just checked and on edit it should load the value for you:

    self::$fields[ $group_key ][ $key ]['value'] = get_post_meta( $resume->ID, '_' . $key, true );

    If special handling is needed, there is a filter.

    Hmm.. this is for the custom fields also? If I need to create a filter then that’s helpful and Ill see if I can figure out which filter it is. Im still mostly new to wordpress development so trying to figure out things is taking a bit longer than I would expect it would take a seasoned WP developer 🙂

    Plugin Author Mike Jolley


    Yes, it should load the custom field value for you.

    So something is messed up. Ill see if I can figure out why it doesn’t.

    Plugin Author Mike Jolley


    Any luck?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Default values for custom fields and multiselect types’ is closed to new replies.