Support » Plugin: Caldera Forms - More Than Contact Forms » Form import does not work in Multisite

  • I am using Multisite. I have exported form from one site and want to import form to another site because forms are same. But it is not working. It gives below error.

    Form could not be imported. File type must be JSON.

Viewing 1 replies (of 1 total)
  • Hi! I just came across to this topic, as I was having the same issue. Sadly, Caldera Forms seems not to provide answers in this forum, and I found a link with the solution, just in case someone needs it eventually.

    Long story short, even if your json import files are ok, it seems that WordPress is unable to recognize those type of files properly. Add this code to your functions.php file, or via plugin (Code Snippets would do the magic for you, and execute it on the admin area) and check if the problem is solved. Worked like a charm to me.

    add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );    
    function wpse323750_secondary_mime( $check, $file, $filename, $mimes ) {
        if ( empty( $check['ext'] ) && empty( $check['type'] ) ) {
            // Adjust to your needs! 'text/html' or 'application/json'
            $secondary_mime = [ 'json' => 'text/html' ];
            // Run another check, but only for our secondary mime and not on core mime types.
            remove_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
            $check = wp_check_filetype_and_ext( $file, $filename, $secondary_mime );
            add_filter( 'wp_check_filetype_and_ext', 'wpse323750_secondary_mime', 99, 4 );
        return $check;


Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.