I have a custom Registration form in my functions.php

    // Registration

    function register_extra_fields(){

    <div class="register-wrapper step-1 col-md-offset-1 col-md-10">

    <?php if( !is_user_logged_in() ) : ?>

        <h4 class="subtitle register-headline"><span>Your account</span></h4>

        <div class="form-wrapper col-md-offset-3 col-md-6">

        <form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">

        <label><?php _e('First Name') ?></label>
        <input id="user_fname"  type="text" size="25" value="<?php echo $_POST['first_name']; ?>" name="first_name"  class="text-input" tabindex="1"/>

        <label><?php _e('I’m interested in') ?></label><small>(Please select at least one option)</small>
        <div class="clearfix"></div>

        <input type="checkbox" id="chk-permanent" name="interested_in" value="Permanent" /><label for="chk-permanent"></label><span class="chk-label">Permanent</span>
        <input type="checkbox" id="chk-temporary" name="interested_in" value="Temporary" /><label for="chk-temporary"></label><span class="chk-label">Temporary</span>
        <input type="checkbox" id="chk-interim" name="interested_in" value="Interim" /><label for="chk-interim"></label><span class="chk-label">Interim</span>

        <input id="uploadFile" name="upload_file" type="text" placeholder="Choose File" disabled="disabled" />
        <div class="fileUpload btn btn-green">
            <input id="upload_cv" type="file" class="upload" />



Which gets updated as follows:-

add_action('user_register', 'register_post_fields');
function register_post_fields($user_id, $password='', $meta=array())  {
    $userdata = array();
    $userdata['ID'] = $user_id;
    $userdata['first_name'] = sanitize_text_field($_POST['first_name']);
    $userdata['interested_in'] = $_POST['interested_in'];
    $userdata['upload_file'] = $_POST['upload_file'];
    update_usermeta( $user_id, 'first_name', $_POST['first_name'] ); 
    update_usermeta( $user_id, 'interested_in', $_POST['interested_in'] ); 
    update_usermeta( $user_id, 'upload_file', $_POST['upload_file'] );  

The registration part is all working and I get get text fields to update. But items such as select options and upload files don't seem to be storing.

I am using ACF and I have added custom fields for the Users.

I can update any text fields that I have added for using ACF, but select and upload files I can't seem to store.

Any help on this would be much appreciated!


You must use enctype="multipart/form-data" in the <form> tag for the file upload to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.