Title: Uncaught SyntaxError: Unexpected token &#8216;:&#8217;
Last modified: January 26, 2022

---

# Uncaught SyntaxError: Unexpected token ‘:’

 *  Resolved [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/)
 * Hi, Hector!
 * I use optimization plugin on my website (Asset Cleanup Pro). And it has an option
   to combine loaded javaScript into fewer files. I enabled it a long time ago, 
   and noticed that the only problem that appears, is with your plugin. So I had
   to add it in exceptions.
 * Several months later I decided to remove it from exceptions and recheck. The 
   problem is still there. So I want to show it:
 * After turning on js combining, in Google Dev console appears an error: Uncaught
   SyntaxError: Unexpected token ‘:’ (/wordpress-popular-posts/assets/js/wpp.min.
   js file). And popular posts design in sidebar gets broken.
 * Also, I have a plugin WP Front Notification bar. I added a fixed bar with text
   and button at the bottom of my website. For some reason, if I remove your js 
   file from combining exception, then this bar disappers. Even though it’s files
   are not added in any exceptions.
 * Here are screenshots:
 * 1 – [https://ibb.co/LppF6PZ](https://ibb.co/LppF6PZ)
 * 2 – [https://ibb.co/9sQ7bcX](https://ibb.co/9sQ7bcX)
 * 3 – [https://ibb.co/5k9x3M9](https://ibb.co/5k9x3M9)
 * 4 – [https://ibb.co/4RW3hGc](https://ibb.co/4RW3hGc)
 * Now I returned your file back to exceptions. I hope, you can solve this, so I
   don’t need to add your file in exceptions anymore!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Funcaught-syntaxerror-unexpected-token-32%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15292790)
 * Hi [@giorgos93](https://wordpress.org/support/users/giorgos93/),
 * > I hope, you can solve this, so I don’t need to add your file in exceptions 
   > anymore!
 * I would but I can’t as this issue isn’t being caused by WordPress Popular Posts.
   See: [Is WordPress Popular Posts compatible with plugins that minify/bundle JavaScript code?](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#is-wordpress-popular-posts-compatible-with-plugins-that-minifybundle-javascript-code)
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15292852)
 * Oh, so it’s on their side. I see.
 * Okay, I’ve just read the instruction. If I add /wp-content/plugins/wordpress-
   popular-posts/assets/js/wpp.min.js in exceptions, and everything works okay, 
   then I don’t need to add a whole /wordpress-popular-posts/assets/js/ path in 
   exceptions, right?
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15293258)
 * > Oh, so it’s on their side. I see.
 * Correct. If you take a closer look at your [second screenshot](https://ibb.co/9sQ7bcX)
   you’ll notice that Asset Cleanup Pro is trying to execute a JSON string as if
   it was a regular JavaScript code. Hence the `Unexpected token ':'` error message
   you’re seeing.
 * Ideally, Asset Cleanup Pro (and other plugins like it) should not attempt to 
   minify / bundle inline script code, only actual .js files. Or at least check 
   that the inline script is not a `type="application/json"` one (like WPP’s) before
   attempting to bundle its contents into a minified JS file.
 * [[
 * > If I add /wp-content/plugins/wordpress-popular-posts/assets/js/wpp.min.js in
   > exceptions, and everything works okay, then I don’t need to add a whole /wordpress-
   > popular-posts/assets/js/ path in exceptions, right?
 * Yep, correct.
 *  Thread Starter [George](https://wordpress.org/support/users/giorgos93/)
 * (@giorgos93)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15293425)
 * Thanks for advices! It actually does have the option to **minify SCRIPT tags 
   with “src” attribute (default)** / **SCRIPT tags with inline JS code** / **All
   SCRIPT tags \* both options**. I am not a programmer, so I just always turn on
   the more attractive option (in my opinion), and see what happens 🙂 Do you think,
   I should turn on **minify SCRIPT tags with “src” attribute (default)** option
   then?
 * And since I’ve asked you: can you please give an advice about the same options
   for css files? Should I turn on **minify LINK tags with “href” attribute (default)**
   instead of **STYLE tags with inline CSS code** and **All LINK & STYLE tags \*
   both options** too?
 * Thanks in advance!
 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15293709)
 * > Do you think, I should turn on minify SCRIPT tags with “src” attribute (default)
   > option then?
 * Yeah, I think that that sounds like a safe option to use (hence why the developers
   of the plugin set it as “default” as there’s a good chance that it won’t break
   anything). Try it out and see what happens.
 * > And since I’ve asked you: can you please give an advice about the same options
   > for css files? Should I turn on minify LINK tags with “href” attribute (default)
   > instead of STYLE tags with inline CSS code and All LINK & STYLE tags * both
   > options too?
 * If you’re using any of the WPP themes (Cards, Cards Compact, etc) then you’ll
   want to pick the first option and leave inline `<style>` tags alone, else the
   design of your popular posts list -again, if you’re using any of the built-in
   widget themes- will break. If you’re not using any of the built-in themes then
   yeah minifying inline `<style>` tags should be fine (or at least that won’t cause
   issues with WPP).

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

The topic ‘Uncaught SyntaxError: Unexpected token ‘:’’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/uncaught-syntaxerror-unexpected-token-32/#post-15293709)
 * Status: resolved