ahmadawais / WPGulp

An advanced Gulp workflow for WordPress development with extensive documentation. Used by 40,000+ themes and plugins.
https://twitter.com/MrAhmadAwais/
MIT License
1.76k stars 303 forks source link

WP nav menu links working but throwing error: Uncaught Error: Syntax error, unrecognized expression: http://localhost:3000/theme_name/ #178

Open Va2 opened 4 years ago

Va2 commented 4 years ago

Since 2 days I have had a very strange error when I put my main menu in WP. I tried 2 different ways, the first one using the WP functions (register_nav_menus & wp_nav_menu). And the second way by simply putting the urls ("http://localhost:8888/theme_name/", ...) in the href of the links. The weird thing is that both ways are working and have almost the same error msg:

Error in the first way (WP functions): Uncaught Error: Syntax error, unrecognized expression: http://localhost:3000/theme_name/

Error in the second way (url in href's): Uncaught Error: Syntax error, unrecognized expression: //localhost:3000/theme_name/

I use WPgulp to develop my WP theme locally with MAMP. So I have access to the back office and the WP theme via urls with 2 different ports (8888 & 3000): http://localhost:8888/theme_name/ => MAMP http://localhost:3000/theme_name/ => WPgulp (npm start to hot reload files etc.)

As mentioned above the links work well so should I just ignore this error that could come from this combination MAMP and WPgulp which have 2 different ports. Because the weird thing is that if I comment the menu (the 2 menus) there is no error and MAMP and WPgulp are also running at the same time...

Probably a silly question but thank you in advance for any information that might reassure me.