file( $_FILES[ 'import_file' ][ 'tmp_name' ] ); } $extension_allow = array( 'json', 'text/plain', 'text/html' ); if ( false !== $extension && ! in_array( $extension, $extension_allow, false ) ) { var_dump('test');var_dump($extension); wp_die( sprintf( esc_attr__( 'Please upload a valid .json file, Extension check. Your file have the extension %s.', 'adminimize' ), '' . $extension . '' ) ); } if ( empty( $path ) || ! is_readable( $path ) ) { wp_die( sprintf( esc_attr__( 'It is not possible to find a file in %s', 'adminimize' ), $path ) ); } // Retrieve the settings from the file and convert the json object to an array. $settings = (array) json_decode( file_get_contents( $path ) ); unlink( $path ); _mw_adminimize_update_option( $settings ); wp_safe_redirect( get_option( 'siteurl' ) . '/wp-admin/options-general.php?page=adminimize-options' ); }