Solution:
WordPress permalinks are intended to be unique. They don’t change, even if you change the preferred domain. New values use the preferred domain, but old values will keep the original values unless you manually edit the values. You can manually edit the wp_posts
table to update the guid
using the new value with the domain and you’ll be back on track.
You can use the following to replace the protocol and IP with the new protocol and domain in all entries with your favorite SQL editor:
UPDATE `wp_posts` SET `guid`=replace(`guid`,'http://1.1.1.1/','https://example.com/');
This doesn’t rebuild the path portion, though. You can do that for the root elements (as long as you haven’t changed anything from the defaults) with this one (caveat emptor):
UPDATE `wp_posts` SET `guid`=replace(`guid`,'http://1.1.1.1/','https://example.com/' + `post_name`) WHERE (`post_parent`=0 AND `post_type` IN ('post','page'));
This updates the guid
to use the new protocol, domain, and the current post_name
value for all post
& page
types that do not have a parent (post_parent
=0). Be aware that the URLs to child posts/pages and custom permalink slugs will still cause problems for you, and will require close attention in order to ensure that they’re reconstructed correctly.