Support » Fixing WordPress » anchor tags on page

  • Resolved tvansant


    I’m having trouble with anchor tags on a page. These are the links that jump to later sections on the same page. An example of the link is To see the list of participating authors, <a href="#list">click here</a> and then the place that it jumps to is <div id="list"><h3>Participating Authors</h3></div>

    In searching the forums I found several recommendations to put the id in the h3 tag, but that makes no difference. I looked at the source of the main page for the codex on this site because they use anchor tags for the table of contents. They use a format like <a name="list" id="list"></a> and that doesn’t work for me either.

    I was about to blame it on the theme or a plugin when I noticed that I have an Add comments link at the top of the page and it does jump to the comment form at the bottom of the page. The link is <a href="#respond">Add comments</a> and it jumps to <div id="respond">...

    If there is a difference between the tag that works and the ones that don’t I’m not seeing it. Is it possible for the theme or a plugin to interfere with my links while the Add comment link still works? Is there something else I’m missing? This one has me totally stumped. I’m working on a test site to work out the bugs before posting on the main site. The test site page is

Viewing 12 replies - 1 through 12 (of 12 total)
  • esmi


    Forum Moderator

    Is it possible for the theme or a plugin to interfere with my links while the Add comment link still works?

    Highly unlikely. Try using a full url in your anchor links – eg:

    I tried using full urls in the links and I also tried just putting a space before the # because I saw that in one of the forum threads. I viewed the page in both Chrome and Firefox on the off-chance that it’s a browser issue too. Still stumped.



    Forum Moderator works for me in Twenty Eleven

    I don’t have the option right now of changing the theme on the site. [For the record, it’s Suffusion with BuddyPress.] I still don’t understand how one anchor tag can work on a page while another one doesn’t, but for now I just changed the page and told them to scroll down for the content. This is very frustrating.

    The way I did this is to add the “anchor” button to the MCE editor toolbar either using a plugin or the code below (can’t remember where I originally found this code). Simply click on the anchor button and add in the name of the anchor. Then link to this anchor where desired using a regular link with #anchorname as the path. If it is on a different page then use the full URL – e.g. http://urltopage/#anchorname .

    Add this code to your the function.php file for your theme (e.g. at the bottom of the file).

    function enable_more_buttons($buttons) {
      $buttons[] = 'anchor';
      Repeat with any other buttons you want to add, e.g.
              $buttons[] = 'hr';
    	  $buttons[] = 'fontselect';
    	  $buttons[] = 'sup';
      return $buttons;
    add_filter("mce_buttons", "enable_more_buttons");

    I was having the same issue as the original poster. sunriseweb’s solution worked for me – thank you!

    You could also use the TinyMCE Advanced plugin to add the anchor (and other) button.

    i am having the same problem but i am not a php coder and don’t want to mess with my function.php file right before launching the site.

    it’s rather astounding to discover that, while wordpress makes many things much easier and even possible, other things like this (and data tables, and rows and columns of product images and text) it makes so much harder than it needs to be. anchor links are very simple when hard coding in html.

    tvansant, try using #name instead of #id

    it’s probably not valid code, but it works for me while #id did not.


    Better start your own topic instead of posting on someone’s thread that is four months old so that you will get better support.

    thanks @krishna, i don’t need support on this issue, i was just making a comment while researching this issue.

    but if you’d like to help, i did post two new topics yesterday in jetpack support topic. thanks!

    Thanks for all the suggestions. After we moved the site to a new server the anchor tags started working as they should. I still have no idea what caused the problem.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘anchor tags on page’ is closed to new replies.