Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter Nate Mackey

    (@mackeyngmailcom)

    The code snippet I uploaded is diff or patch. The – and + signs at the front of each line indicate what changed between the original and updated versions. The final code block for uploading files and images should be the following:

    if( $field_type == 'image' || $field_type == 'file' ){
    
                            if( isset($_FILES[$key]) && !vmb_is_empty($_FILES[$key]['name']) ){
    
                                    /////////////////// HANDLE FILE UPLOAD and POPULATE VALUE VARIABLE
                                    $overrides      = array('test_form' => false); //WHY DOES THIS NEED TO BE HERE?
                                    $image          = wp_handle_upload($_FILES[$key],$overrides);
    
                                    if (empty($image['error'])) {
                                            $value          = $image["url"];
                                            if( vmb_is_empty($value) ){
                                                    delete_post_meta($post_id, $key);
                                            }else{
                                                    update_post_meta($post_id, $key, $value);
                                            }
                                    }
                            }
                    }
Viewing 1 replies (of 1 total)