Does anyone know how to fix the anchor links between pages problem?

I made a lot of research on why anchor links don’t work between pages. According to this post some kind of JS function could be causing this issue. I couldn’t find a proper solution though. Any ideas?

Do you have a page or something we can look at? Are you adding these links through code or just in a WP post? I am not sure the post you refer to would be the problem because that seems to be a very niche case. However, I guess it is possible. We won’t know until we can look at the problem.

Post what you got going and we can dive into it.

1 Like

Hi and thanks for the fast reply. I am not adding any code, just id tags with absolute urls that link to specific sections of the home page. I’ve published my site so you can look at it. Basically, if you are on the Portfolio page, anchor links to the home page won’t work.

From the portfolio page, if for example you click on services, it throws an error in the console.

Uncaught Error: Syntax error, unrecognized expression: https://www.aprellezo.com/#services

The link doesn’t work at all.

If you go to developer tools, elements and look at event listeners, under click there is the following script

custom.js?ver=1.0.4

If you right click on that and select delete eventlistener, then the link does work, albeit it doesn’t scroll to the anchor on the page.

The custom.js does appear to be the problem. Who developed it? Is it part of the mestc theme?

Just to add, I may be barking up the wrong tree here.

edit:

This particular section of the custom code, stands out to me. handleClick, handleClickSubMenu etc

Edit2:

Might it be worth contacting the creator/support of the metsc theme and asking for support with this?

2 Likes

Hi and thanks for taking the time to search for the issue and your suggestions.

I guess custom.js comes with the theme. I haven’t created it, that’s for sure.

I’ve already contacted the theme creator so let’s see if they provide a solution.

Thank you

2 Likes