Portable Post Links

I quite often run into a situation where I develop a site on a staging domain, have my client fill it there with content, and then when everything’s approved move it to production. Now, my installation is quite portable (permalinks, assets are all fine), and I have environment-specific configuration, the only thing that doesn’t adapt to the environment is when a client links to a post from another post through the popup in the editor. These links appear to be just hard-coded in the HTML.

Is there a way to make these links relative to the url without effort on my client’s side?

Thanks!

2 s
2

WordPress is strongly opinionated about using absolute URLs. Doesn’t mean it’s better but it’s a choice is makes.

The common way to handle it is replace as necessary in database. Please note that if you run replacement on all of database it is extremely important to use serialize–aware tool, or you risk corrupting the data.

Leave a Comment