allow File field to upload .json to specific directory

Support General allow File field to upload .json to specific directoryResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #19475
    rubbergumballrubbergumball
    Participant

    I've working on a post meta that I need to upload a .json file to a specific directory under wp-content. In my testing I see that I can upload PDF or image files, but not .json.

    I've added a mime types filter - but the file is still not uploading.

    add_filter( 'upload_mimes', 'my_myme_types', 1, 1 );
    function my_myme_types( $mime_types ) {
      $mime_types['json'] = 'application/json'; // Adding .json extension
      return $mime_types;
    }

    Thank you.

    #19484
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please add this code define( 'ALLOW_UNFILTERED_UPLOADS', true ); to the file wp-config.php and should before the line /* That's all, stop editing! Happy publishing. */ then upload the file .json again.

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