Support

Account

Home Forums Backend Issues (wp-admin) Admin File Field Values not Displaying on Post Save – Custom Metabox Reply To: Admin File Field Values not Displaying on Post Save – Custom Metabox

  • Sorry, here are the document variables from above the previous section of code. Just in case it helps.

    // Field Array DOCUMENT ATTACH Metabox
    $class = 'active';
    $icon = wp_mime_type_icon( $file->ID );
    $title = $file->post_title;
    $size = size_format(filesize( get_attached_file( $file->ID ) ));
    $url = wp_get_attachment_url( $file->ID );
    
    $explode = explode('/', $url );
    $name = end( $explode );
    
    $prefix = 'document_';
    $document_meta_fields = array(
        array(
            'label' => 'Document Upload',
            'desc'  => 'Upload or Select Document.',
            'id'    => $prefix.'file',
            'type'  => 'file',
            'class' => $class,
            'icon'  => $icon,
            'title' => $title,
            'size'  => $size,
            'url'   => $url,
            'name'  => $name,
            'defaults' => array(
                'save_format'   =>  'object',
                'library'       =>  'all',
            ),
            'l10n' => array(
                'select'        =>  __("Select File",'acf'),
                'edit'          =>  __("Edit File",'acf'),
                'update'        =>  __("Update File",'acf'),
                'uploadedTo'    =>  __("Uploaded to this post",'acf'),
            ),  
            
        ),
    );