Why is it that Wordpress 4.4.2 does not use relative links (get_bloginfo, or such things) when I use the "internal editor mechanism" to link to existing pages and posts in a site.

My local WAMP environment sits under localhost. However, when I after some time developing use this in my wp-config...


...to be able to access my local environment from mobile devices over LAN, all links to pages and posts break, and I have to rewrite permalinks in order to get them working again. This is normal and not my question.

The thing that puzzles me is that even after rewriting the permalinks, some links remain broken. Namely, those that have been created in the internal editor by linking to "existing posts and pages". IIRC the same problem exists when moving from dev to production. One would think WP would be able to understand that these links are also within the site, just as menu items etc...

1) Why does WP not understand this?

2) Is there any way to prevent it, short of directly editing the DB or using a plugin to do the same?

  • If you want a truly simple way around this, you could spoof your hosts file on your local computer. Pointing to your domain. Then whenever you go to your domain, it will load from localhost rather than on the internet (only for your computer). No need to modify your WordPress files or database that way. Literally just pull a copy of your WordPress files and Database to your local development and you're good to go. Just remember to revert your host file changes when you're done so that your domain loads from the internet instead of from local. Commented Apr 1, 2016 at 13:53

1 Answer 1


Your question seems to have been already answered by a user here: https://stackoverflow.com/a/18516783/844732

However it sounds like your problem would be solved by using this plugin:

Relative URL

Relative URL applies wp_make_link_relative function to links to convert them to relative URLs.

Yoast also has some background on relative URLs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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