2

From the Moving WordPress codex page (emphasis mine):

When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.

If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have two options:

  1. Only perform a search and replace on the wp_posts table.
  2. Use the Search and Replace for WordPress Databases Script to safely change all instances. ( If you are a developer, use this option. It is a one step process as opposed to the 15-step procedure below )

What are the benefits of saving the site_url vs. using relative links? Is it because of performance? Or is there some other benefit (e.g. SEO-related or technical) when hyperlinks in the content are fully qualified?

Because it certainly makes WordPress more difficult to use when developing in a team, when you have a shared database with your test/acceptance environment, and when 'going live' with a WordPress website.

1
  • 2
    We use define('WP_HOME' and define('WP_SITEURL' during development and testing, but that doesn't solve the serialization issues, and therefor doesn't make the 15-step process or the 3rd-party script obsolete at all. Nov 12, 2012 at 13:00

1 Answer 1

4

This question has been discussed several times on the WordPress Hackers email list, I'd recommend Googling something like wp-hackers absolute relative to get an overview of the various lively debates that have taken place over the years.

Personally I use the searchreplacedb2 script whenever I migrate a database between URLs, e.g. from live to local/test/dev.

Your Answer

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

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