After migration, why do URLs in WordPress editor show as IP addresses instead of domain names?
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://126.96.36.199/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.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×