Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My WordPress site is set up with "Post name" permalinks.

Now I created an anchor in every page at a certain place:

But I find that when I try to link to that page, and its anchor, like this:

http://example.com/mypost#my_anchor

.. it doesn't work. The URL gets converted on the fly to:

http://example.com/mypost/#my_anchor

... so the link never goes to the correct part of the page.

Anyone know what I'm doing wrong - how to correct this?

(Note: I did see a very similar question where someone had this a problem after they put an extra slash on the end, after the anchor part, but I'm not doing that.)

Thanks.

PS It doesn't work if I use a div with an id instead of the anchor, either.

share|improve this question
    
The link should work the same with or without the leading slash, but the trailing slash does break it. I just tested all three versions. Something else is wrong but I can't tell what from the question. Named anchors are not supported in HTML5 so whatever you do, use an id. –  s_ha_dum Aug 31 '13 at 18:56
    
I used an anchor with an ID and a div's ID but both exhibit the above behaviour. –  John Doe Aug 31 '13 at 19:08
    
And I tested both cases and both work fine. There is something peculiar to your setup-- code, browser, OS, something-- that is causing this not to work correctly. It doesn't help that you provided a dummy sitename. That has zero debugging value. –  s_ha_dum Aug 31 '13 at 19:26
    
Seems I'm not alone in finding this behaviour: bit.ly/19cBRJP - except I din not have a trailing slash, as that poster didn't to begin with though he kinda forgot that. –  John Doe Sep 2 '13 at 17:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.