Part of my work is to create Wordpress websites. I usually work on my laptop until I have something good enough to be uploaded to the test server where the client reviews it.
I create a VirtualHost for every new project so I'm always working with a Wordpress installation in a domain that looks like http://local.example.com/
, but when the site is uploaded to the test server (not controlled by me), the domain may end being something like http://testserver.com/arbitrary/path/example/
.
The problem is that if I add a custom link to a menu that points to, for example, /events/
, it would work fine locally creating a link to http://local.example.com/events/
, but in the test server, the link will point to http://testserver/events/
, which is obviously not right.
What I want is to give the custom link an URL that would work both on my local environment and the test server.
I already handle the problem of changing the home
and siteurl
Wordpress options by:
- changing those settings on the local database
- creating a dump of the database
- update the database on the server
- restoring the local options.
I don't want to use full URLs for the custom links and having to replace those with the server URL every time I need to update the server's database.
For links inside the post content, there is a plugin that solves the problem adding two shortcodes: http://wordpress.org/extend/plugins/url-shortcodes/, but I haven't been able to find something similar for Custom Links.