The page and post links added to WordPress menus are relative in nature. I need a way to force them to be absolute without using the "Custom Link" option.

Is there some function or maybe a modifier that I can use with wp_nav_menu() to accomplish this?

  • Huh? I'm not clear on what you are asking. Question for you: On your wp-admin panel, settings, permalinks what setting are you using? (my recommendation is to use: Post Name) Does that resolve your problem? What, exactly what are you trying to achieve?
    – zipzit
    Oct 8 '15 at 2:29
  • This sounds like a CSS related problem. In your child theme just modify their classes and add absolute value instead of relative (with proper fine tuning). Oct 8 '15 at 7:05
  • The OP is referring to absolute URLs, not absolute positioning. I'm guessing you want them pointing to somewhere other than your site URL?
    – vancoder
    Oct 8 '15 at 21:28

Check out the nav_menu_link_attributes filter. Using this you should be able to grab the href and modify it as you require.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.