WordPress.org

Ready to get started?Download WordPress

Forums

Relative URLs in WordPress nav menus (3 posts)

  1. Maxaud
    Member
    Posted 1 year ago #

    I'd like to save a relative URL to a WordPress nav menu.

    So I enter "link-url" as the URL I want to save but it gets saved as "http://link-url"

    How do I prevent it from saving with the "http://" prepended to it?

    My hack so far is to prepend the value with "relative|" and when the menu is being output I do a PHP str_replace on the "http://relative|" removing it, but I would like it if WordPress just trusted my input and didn't force "http://"

    Thanks!

  2. kmessinger
    Volunteer Moderator
    Posted 1 year ago #

    I guess you know wp does not like relative urls. There are solutions, maybe a plugin - it has been talked about a lot. Search relative+url

  3. Maxaud
    Member
    Posted 1 year ago #

    @kmessinger, Not finding much on this topic.
    I see a lot about relative URLs but not the nav menu items created in "Appearance > Menus"

Topic Closed

This topic has been closed to new replies.

About this Topic