Home > Mobile >  WP_POSTS shows "guid"-links with http://localhost/
WP_POSTS shows "guid"-links with http://localhost/

Time:10-28

I've run the google-pagespeed-insight tool, on which one link has been marked as not being https. Further investigations lead to a lot of links in wp_posts having http://localhost/(...) as links.

It may be due to me moving of the site from a localhost installation to the live webspace.

So I'm wondering, if i could delete those links, as they won't really point anywhere. Is there anything else i'd have to check, like other tables?

Thanks folks!

Investigated links via wp_posts and found lots of localhost ones.

CodePudding user response:

Posts and pages with links to other posts and pages need to be updated when migrating WordPress sites from one origin domain (like http://localhost) to another (like https://example.com). Hyperlinks inside posts and pages need changing. Therefore, migration is a screaming pain in the xxx neck to do correctly unless you use a migration plugin to do the hard work for you. Then it's simple.

I use Duplicator, but there are several other good choices in the plugin repo.

If you have the choice of repeating your migration using a plugin, that is a good way to handle this.

CodePudding user response:

If the URL's are not being triggered on the pages then you are free to delete them, however this could result in unwanted errors. Therefor I suggest you replace all old localhost URL's inside of your database with your new URL.

You can achieve this using the following SQL query.

UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com'); UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');

Or you can use a WordPress plugin, when I worked with WordPress we mostly used wp-all-import. Make sure that after you imported a website using any migration plugin you save the permalinks in the settings tab in wp-admin.

  • Related