Absolute URLs are easier to change with a global search and replace. Relative URLs are difficult to alter later and make the regular expressions needed to do so much more difficult to create.
And this is a very common real-world situation I’m about to depict.
If I have saved all my URLs like this: https://domain.com/wp/foobar
And I decide I want to move to https://domain.com/foobar
Then I can search/replace for https://domain.com/wp/ and replace with https://domain.com/
On the other hand, if I’ve saved them all as /wp/foobar, then the search for /wp/ runs the risk of hitting other URLs that may also use that. So then I have to search for href="/wp/
and src="/wp/
and hope I get them all. Now I’ve got at least two searches to the previous one.
More work.
Benefits of Absolute URLs:
- Easier search/replaces
- Works well with all feeds (relative URLs don;’t)
- Not having to run a query to check the URL every time you want to load a link or image
- Easier support with dynamically generated content (if this was a static HTML site, I’d agree with relative URLs, but WP is all dynamic and things get moved)
Now. talking about changing core is a bigger issue than you mention becuase we must remain backwards compatible (this is a hallmark of WP, and we’re proud of it). When you make a big change, you simply cannot break everyone’s site ?? Oh and consider Multisite, if you will. Relative URLs there change depending on if you map domains or not, right away, and then they’re parsed through a ms-files.php file but have the URL of /file/… – More things to make sure we don’t break.
By the way, the reason this isn’t an option is that WP believes in decisions, not options, so making this an optional setting is unlikely to happen. Whenever possible, we like to have a ‘this is what it is’ and done.
The move from development to production is a one time thing. It’s not hard to do, and if you wanted to make your life even easier, when you build out locally, you could edit your hosts file to have domain.com point to your local site ?? (I generally use domain.loc and then search/replace that for domain.com in the end, to prevent any brainfarts on my end, and to make sure I’m looking at the right site all the time).