WordPress: Update URLs
When developing websites it is often necessary to develop on a test domain then move the site to its live domain once everything is in place. When doing this you will need to update the URL’s and links within WordPress to reflect your domain change. Once the domain is changed there are 3 steps to take to update the links on the rest of the site:
- Update the URL references in your database.
- Update URL’s in posts, pages, custom post types, excerpts, links, media attachments, custom fields, and meta boxes in WordPress
- Update URL’s in WordPress widgets and theme settings
Update Database the URL References
The first step is to update the option_value column for the siteurl and home records in the wp_options table to match your new domain. If this step is missed anytime you attempt to login to your admin panel you will be redirected to the old domain.
Update URL’s in Posts, Pages, Custom Post Types, Excerpts, Links, Media Attachments, Custom Fields, and Meta Boxes
The first step is to update the URL’s in the posts, pages, custom post types, excerpts, links, media attachments, custom fields, and meta boxes.
- First install the plugin Velvet Blues Update URLs and activate it.
- Once activated head on over to its utility page in your dashboard from the menu under Tools | Update URLs.
- Type in your old URL in the first box and the new URL in the second.
- Check all but the ALL GUIDs option and click [Update URLs NOW]
You can uninstall the plugin if you want after this point.
Update URL’s in WordPress Widgets and Theme Settings
Lastly we must update URL’s in widgets and theme settings. The widgets can be found from the menus Appearance | Widgets section. Once on this page expand all of the widget areas and display all of the widget options using the arrows on the title bar.
Use your browsers find feature (Windows: Ctrl + F | Mac: Cmd + F) to search for any reference to the old domain and update them.
Every theme is different but commonly you will find its settings in the Appearance | Theme Options page and/or in the Appearance | Customize page. You must update these links manually just as we did with the widgets.
Recent Comments