Custom Fields
Re-Envisioned
Support General allow File field to upload .json to specific directory

  • Creator
    Topic
  • #19475
    Resolved rubbergumball
    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.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #19484
    Long 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 1 replies (of 1 total)
  • You must be logged in to reply to this topic.