Title: Using shortcode error
Last modified: June 3, 2026

---

# Using shortcode error

 *  Resolved [lawrenceprak](https://wordpress.org/support/users/lawrenceprak/)
 * (@lawrenceprak)
 * [1 month, 3 weeks ago](https://wordpress.org/support/topic/using-shortcode-error/)
 * when adding a shortcode onto page, I am getting a javascript import error and
   an empty saveto-wishlist-item element presented.
 * Uncaught SyntaxError: Cannot use import statement outside a module (at index.
   B3IUFaGN.js?ver=1780496387:1:170)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Fitri Sinta](https://wordpress.org/support/users/supportfitri/)
 * (@supportfitri)
 * [1 month, 3 weeks ago](https://wordpress.org/support/topic/using-shortcode-error/#post-18928318)
 * Hello [@lawrenceprak](https://wordpress.org/support/users/lawrenceprak/),
 * Thanks for reporting this! We’ve been able to reproduce the issue and identify
   the cause.
 * The error occurs when a JavaScript optimization or caching plugin is active on
   the site, such as WP Rocket, Autoptimize, LiteSpeed Cache, SiteGround Optimizer,
   or similar tools. These plugins can interfere with how our frontend script is
   loaded by stripping a required attribute that tells the browser to treat it as
   a modern JavaScript module.
 * If you have a JS optimization plugin active, please try temporarily disabling
   features such as:
    - Combine JavaScript
    - Minify JavaScript
    - Defer JavaScript
 * Then test again to see if the wishlist loads correctly. If it does, that confirms
   the conflict.
 * We’ve already logged this as a bug, and a fix is currently in progress. We will
   let you know once the fix is available.
 * In the meantime, if you let us know which caching or optimization plugin you’re
   using, we can provide more specific guidance on excluding our scripts from its
   optimization settings.
 * Sorry for the trouble, and thanks again for reporting it.
 *  Thread Starter [lawrenceprak](https://wordpress.org/support/users/lawrenceprak/)
 * (@lawrenceprak)
 * [1 month, 3 weeks ago](https://wordpress.org/support/topic/using-shortcode-error/#post-18928902)
 * I narrow it down to **Wordfence Security**. The error was it was out putting 
   both type=”text/javascript” and type=”module”. In this cause we only need type
   =”module.”
   I was able to correct it via theme functions:
 *     ```wp-block-code
       add_filter('script_loader_tag', 'theme_force_clean_module_tag', 9999, 3);function theme_force_clean_module_tag($tag, $handle, $src) {    // Only target your scripts (IMPORTANT)    if (strpos($handle, 'saveto') === false && strpos($src, 'savetowishlist') === false) {        return $tag;    }    // 1. Remove ANY existing type attribute (fixes duplicates)    $tag = preg_replace('/\s*type=("|\').*?\1/', '', $tag);    // 2. Force module cleanly    $tag = str_replace('<script', '<script type="module"', $tag);    return $tag;}
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fusing-shortcode-error%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/saveto-wishlist-lite-for-woocommerce/assets/icon-256x256.
   png?rev=3411707)
 * [SaveTo Wishlist Lite – WooCommerce Wishlist](https://wordpress.org/plugins/saveto-wishlist-lite-for-woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/saveto-wishlist-lite-for-woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/saveto-wishlist-lite-for-woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/saveto-wishlist-lite-for-woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/saveto-wishlist-lite-for-woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/saveto-wishlist-lite-for-woocommerce/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [lawrenceprak](https://wordpress.org/support/users/lawrenceprak/)
 * Last activity: [1 month, 3 weeks ago](https://wordpress.org/support/topic/using-shortcode-error/#post-18928902)
 * Status: resolved