getMessage() ); } } public function bblocks_template_import(){ $nonce = sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) ?? null; if( !wp_verify_nonce( $nonce, 'wp_ajax' )){ wp_send_json_error( 'Invalid Request' ); } try { $data = Image::instance()->maybe_import_images( wp_unslash( $_POST['original_content'] ) ?? '' ); wp_send_json_success( $data ); } catch ( \Throwable $th ) { wp_send_json_error( $th->getMessage() ); } } } new Templates();