Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
1  
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. –  michielvoo Nov 12 '12 at 13:00
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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