0

I'm trying to add links to my posts. How can I link to my pages where I don't have to use the domain but only the pathway?

Default:

http://domain.com/post-title

Change to:

/post-title

I once had a client who had this functionality on her WP site.

2

WordPress always uses the full URL when it inserts a link. There are a number of reasons for this, and they are all good reasons.

You can add relative URLs yourself by simply typing your own links and omitting the domain portion of the link.

So http://sitename.tld/cool-page becomes /cool-page.

As I said, though, this is not the best practice to develop. it creates a lot of potential for ambiguity and inefficiency.

Here are a couple of links for reasons to not do that and just use the tools WordPress offers you instead.

https://yoast.com/dev-blog/relative-urls-issues/

https://moz.com/blog/relative-vs-absolute-urls-whiteboard-friday

  • What do you mean by relative URLs? – Aurora Afable Jan 31 '17 at 0:16
  • Relative URLs do not include the domain, just the path from the document root. – Dane Morgan Jan 31 '17 at 0:19

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.