After migration, why do URLs in WordPress editor show as IP addresses instead of domain names?

July 20, 2018 525 views
WordPress Ubuntu 16.04

TL;DR: on the backend of WordPress, in the post editor, links to other pages and media within my own site appear as the IP address instead of the domain name. (Links to external sites appear normal.) For instance, in the editor I see http://1.2.3.4/image.jpg instead of https://sitename.com/image.jpg. However, viewing the post in a web browser, the images load correctly and viewing the page source in the browser shows the correct https://sitename.com/ URLs. This only occurs on existing posts (400+) but not new posts. All other aspects of the site on the front and back ends work 100% normally.

I've Googled the hell out of this and can't find a solution.

Longer story: I have a DO droplet with two instances of WordPress running, setup with ServerPilot. Both WordPress sites have been migrated from a different host. Both were previously on insecure (non-SSL) hosts, and I setup SSL after migrating to DO. The first WordPress site is running without issue. The second one has the problem described above. I don't know if this is a WP problem, a ServerPilot problem, or a DO problem. If this is outside the purview of this community, please point me in the right direction.

A curious quirk is that in the backend WordPress editor, I'm now being told that "There is an autosave of this post that is more recent than the version below" (even if I haven't made any changes). When I view the autosaved version versus the current one, my current version suddenly shows the correct URLs with the domain name, and the autosaved version is the one with the URLs as IP addresses. Regardless of whether or not I retain the current version or restore the autosave, as soon as I get back to the editor, all the URLs are IP addresses again. I’ve done the usual troubleshooting of disabling plugins, clearing caches, etc.

Adding to my frustration, if I make one small change to a post, even just one character, and then publish the update, the page suddenly becomes insecure according to my web browser, and viewing the page source in my browser now shows all the URLs in their http (not https) IP address form. At this point, if I run the Velvet Blues Update URLs plugin from the WordPress backend (essentially a find and replace plugin) to replace all the http IP instances with https domain name instances, it reports success and refreshing the frontend page in the browser once again shows it as secure. However, on the backend the URLs still show as IPs in the editor.

Lastly, if I do a manual find and replace in the post editor (instead of using the plugin), that seems to "stick" and the URLs don't revert to IP addresses. However, the autosave message keeps appearing (even when no changes have occurred), which makes me think the problem isn't totally solved. Comparing the current and autosaved versions side by side shows them to be identical.

2 Answers

What tool did you use to migrate the websites?

  • The All-in-One WP Migration plugin. I’ve used it for countless other sites without issue.

    • Did you try to reupload the back'up file? It seems that if the domain did not yet fully propagate to the new ip, the tool in question would change the hostname with the server ip address. A second upload of the back'up file would most likely fix the issues.

I also have a problem where the IP address shows up in the editor... I'm not sure why. In the actual user end it shows my url, but in the editing part, it shows my IP.

Have another answer? Share your knowledge.