How to upload vcf file to custom post type custom field upload file

Support General How to upload vcf file to custom post type custom field upload fileResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #34421
    Leo HermantoLeo Hermanto
    Participant

    Hi,

    I am trying to create a team vcard in the team cpt. I am using custom field upload file for this purpose.

    But it seems that I cannot upload vcf file as it is being greyed out and I also cannot drop the file into the field.

    I understand that this could be wordpress security feature and I tried using this snippets from another site of mine that works before with toolset but is not working with metabox,

    // Enable vcard upload
    function enable_vcard_upload( $mime_types=array() ){
    $mime_types['vcf'] = 'text/vcard';
    $mime_types['vcard'] = 'text/vcard';
    return $mime_types;
    }
    add_filter('upload_mimes', 'enable_vcard_upload' );

    Any assistance on the above is appreciated.

    #34437
    Long NguyenLong Nguyen
    Moderator

    Hi Leo,

    Using your code to enable uploading a vcf file on my local site works as well, screen record https://monosnap.com/file/oJG4T3mNHrW7D3yCUX76m8yRKM046X

    Can you please run the code with Code Snippets and re-check the issue?
    https://wordpress.org/plugins/code-snippets/

    #34442
    Leo HermantoLeo Hermanto
    Participant

    Hi Long

    Thanks for this, I tried code snippets, it works, I realised the mistake with advance scripts that I am using is the wrong hooks, I should just set it to init, then it will works the same.

    Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.