Fixing Image Links After a WordPress Migration

As we continue our tutorial series on migrating your WordPress site to InMotion Hosting, the next thing we want to cover is how to update the URLs for images within your pages and posts. They are coded differently so simply changing the site URL will not fix this. In this tutorial we show you how to fix image links by using your phpMyAdmin tool.

How to Fix Your Image Links After a WordPress Migration

  1. Log into your cPanel interface.
  2. Once inside the cPanel, find the Databases category and click on the phpMyAdmin tool icon.
    select phpmyadmin tool
  3. You are now on the main phpMyAdmin page. Find the newly added database and click on its name from the left-hand sidebar. Our sample database is named testdb.
    select new database
  4. This opens the database and the screen refreshes with a list of the tables. Using the sidebar again, find and click on the wp-posts table.
    select database table
  5. Look to the top of the screen and you will see several tabs that run across the page. Click on the SQL tab.
    click the SQL button
  6. You are now on a MySQL editor screen. In the code area, copy the following bit of MySQL.
    UPDATE wp_posts SET post_content=(REPLACE (post_content, '',''));

    Be sure to replace with the old sitename and with the new site name. For instance, our original site was inmotiontesting.com and the new test site will be at test.inmotiontesting.com so the code should appear as below:

    UPDATE wp_posts SET post_content=(REPLACE (post_content, 'inmotiontesting.com','test.inmotiontesting.com'));

    Click on the Go button to run the code and change the URLs for all images in the posts. This will also affect any other ‘hard coded’ links that were in the posts that pointed to the original site.

    enter the SQL code and run it

Below are before and after shots of the changes made. Note that the image paths are displayed in the lower left hand corners of the images. You can see how they switched to the new sitename after the SQL code ran.

BeforeAfter
before the link changeafter the link change

136 thoughts on “Fixing Image Links After a WordPress Migration

  1. That’s great, but I have an issue: Mu URL has an hyphen (-) and it doesnt seem SQL accepts it, what can I do?

  2. Thanks for the info. I watched some videos on youtube but they couldn’t help. Your article may be long but it’s as clear as day

  3. My friend told me some people with similar problems could get a solution by fixing their permalinks settings in the wp dashboard.

    1. I got an error when I try it:#1054 – Unknown column ‘‘quantum.esu.edu’’ in ‘field list’

      UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘quantum.esu.edu’,’quantumnew.esu.edu’));

      All of my images links are in a column called guid.

      1. I’m sorry to see you are receiving an error. Can you please provide more details as far as what you are doing when you see that error message?

  4. hi how to solve this issue blank images show in the library and broken image showin the website view so how to solve this issue my site is not migrate 

    1. I’m sorry to see that you are experiencing issues with the images on your website and in the media library. Following the guide above, typically corrects this issue. Is there a particular step in this guide that you need further assistance with or clarification on?

  5. You are awesome. Thanks for the tutorial. Did a migration and got the broken thumbnail icons in my post editor. Never thought that the images were still being pointed from the old primary domain of my site. Your solution worked perfeclty. Well done!

  6. Hi what if I dont have a post but my pictures are in the media gallery. Can someone please paste a query for that. My website is ‘example.com’ Under Photography > Engagement > pick a couple – I can see the pictures in tiles, but the moment I click on the picture, it says ‘the image could not be loaded’. 

    please help

    1. If your photos are being displayed in a Gallery, it is likely you are using a separate plugin for the Gallery feature. In this case you will need to review the documentation for that plugin to determine if it is possible to update the URL used for each image to the new URL you want to use.

      Please ensure you have a working backup of your website before proceeding with this kind of website maintenance, then you can try another plugin: Velvet Blues Update URLs. This plugin may be able to update the image links/references in the Gallery plugin by searching and replacing the previous URL with the new URL.

      Unfortunately, if that plugin does not work then you will need to manually recreate the Gallery.

  7. it,s really works and it article is took back again my all website image link after migration and thank you sir for this article and also thanks to your team from *********.com

  8. Look in the left hand column for the name of your _posts. The name of my posts was “wpxj_posts”, rather than “wp_posts”, so it worked after I changed to that name.

    Also, there was a line of script already in the box, and I had to end it with a “;” before the new script would run.

  9. Use this many times. Others, make sure you change wp_posts, the ‘wp_’ to your table prefix. Check your config file. My questions is, anyone have problems after changing say http to https in DB. But when you go to edit page, it is still http. But is https in DB! Only on images, happens a lot and wondering why! No, not cache!

  10. I’m getting the following Error.   Another thing,  for some reason all my tables have _KPQ_  instead of WP ( _KPQ_posts)
     
    Error
    SQL query:

    UPDATE wp_posts SET post_content=(REPLACE (post_content, 'emdrinoakland.com','dev.emdrinoakland.com'))

     
    MySQL said: 
    #1146 - Table 'emdrinoa_dev.wp_posts' doesn't exist

    1. Hello.

      If your database prefix is not the default “wp”, then you will need to modify the query that we have in this guide. For instance,

      UPDATE wp_posts SET post_content=(REPLACE (post_content, 'yourdomain.com','yournewdomain.com'));

      would need to be replaced with:

      UPDATE _KPQ_posts SET post_content=(REPLACE (post_content, 'yourdomain.com','yournewdomain.com'));

      . Once you change the prefix to match the prefix chosen for your database, the command should work.

  11. Hell, I ran this and the query seemed to run successfully (985 rows affected), however now all the images are missing on the site!

    1. I recommend restoring the database from a backup and retrying to change the URLs using the plugin Velvet Blues Update URLs. In my experience that plugin works best. I always recommend to make a backup before manipulating your site in this manner. I hope this helps!

  12. Sorry if i wasn’t clear. I want to change the urls from MySql fields, so my old image paths (from multiple folders) to be renamed to the single new folder. I think a combination of REPLACE, CONCAT and/or SUBSTR could do the trick.

    example:

    OLD DB record

    https://www.oldsite.com/path1/path2/image1.jpg

    https://www.oldsite.com/path1/image2.jpg

    https://www.oldsite.com/path1/path3/image4.jpg

    NEW DB record

    https://www.newsite.com/path/image1.jpg

    https://www.newsite.com/path/image2.jpg

    https://www.newsite.com/path/image3.jpg

    etc

    1. You will have to create a custom query for this, here is a helpful link to an SQL Syntax guide that provides definitions and examples of SQL statements.

      Thank you,
      John-Paul

  13. Hello, what if i have multiple urls (ie ‘path1/pathb/image.jpg’ and ‘path1/patha/image2.jpg’ etc). What is the query syntax to trace the 1st ‘/’ from the right and replace all text to its left to the current url. (path1/pathb/image.jpg –> url/image.jpg)

    Hope it made sence. Thanks in advance

    1. If the change is permanent, then you need to write a 301 redirect. It will basically be re-writing the path to the new one. You can find out how to do this in our tutorial: Setting up a 301 redirect. There are examples either in the artlcle content or in the many customer requests in the comment section.

  14. Hi,

    Tried your trick but now this happens: wordpress is getting “https://www.blog.wmw.com.br” when it should not be getting the “www.blog”.

    I used this: UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘wmw.com.br’,’blog.wmw.com.br’));

    Any insights on how to solve it?

    1. The SQL query used here is only meant to update the post content information. The site’s Home URL is set in the configuration file or from the Admin area under General settings. I advise checking to see what the Home URL is configured for or if there are any .htaccess rules that are adding the `www.`

  15. hi, i get the following error during the final step. please advise. thanks.

    Error
    SQL query:
     
    UPDATE wp_posts SET post_content=(REPLACE (post_content, '<https://107.6.152.178/~relocat9>','<https://107.6.152.178/~relocat9/test>'))

     
    MySQL said: 
    #1146 - Table 'relocat9_test.wp_posts' doesn't exist
     

    1. Hello,

      The error you are getting is because the table relocat9_test.wp_posts does not exist, I would ensure that you are urunning the command under the correct database and that your database does have the table wp_posts.

      Best Regards,
      Kyle M

  16. Hi

    I’ve recently changed my HOST from Windows to Linux.

    I restored my post from old host to new one.

    Now I’m using WP, and there’s this annoying problem with showing pictures.

    All my post’s image url were like : sitename.com/wp-content/uploads/pic.jpg

    And ever since I restored the data, none of blog posts are showing the images.

    New image url is : sitename/wp-content/uploads/year/month/pic.jpg

    What can I do to use the media ? I can’t change the pictures url for each one of posts.

    1. You should be able to correct this setting under Settings > Media by disabling the checkbox for “Organize my uploads into month- and year-based folders.”

  17. Hello Arnel,

    Thank you for your suggestion to run the query. I went ahead and created a test environment on sub domain with the exactly similar config (abcd.com/wp). Here I did move everything successfully to (abcd.com), updated the permalinks as well. But still there are some broken links. I went ahead and ran the query and got the following error.

     

    Following is my query that I ran:

     

    UPDATE wp_posts SET post_content=(REPLACE(post_content,’ssent.net.in/wp’,’ssent.net.in’));

    Following is the Error I receieved:

    #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ”ssent.net.in/wp”ssent.net.in’)) FROM wp_posts WHERE’ at line 1

    Can you please give me any guidance here.

    With Regards,

    Sakar

  18. Hi Inmotion Hosting Team,

    Do I follow the same if i am moving my wordpress site to root directory. Just to clarify, I have my current wordpress files under abcd.com/wp and am planning to move it to abcd.com. Here I am going to use the steps as mentioned in your video ‘How to move your WordPress Site from subfolder to the directory’ (also permalink updates if required). But my query is do I still need or will I have to run the SQL query in any case ? Or is it simply if only there are broken images ? .. Thank You for the Tutorial Videos, I am new to WP and happy that you guys are helping out even newbies just as me.   

    1. Hello,

      It depends on how you move your site. If you’re physically moving ALL of the files to the root directory, then (instead of just changing the site address in the settings), then I would recommend running the query to cover your bases. You can see a more details on the process in Moving your WordPress site to the Root Directory..

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  19. dont forget to change XX where “wpXX_tablename” , which is prefix for table names in your sql queries.

     

    UPDATE wpXX_posts SET post_content=(REPLACE (post_content, ‘old.com’,’new.com’))

  20. Hi There
     
    I am getting this error when I try to replace all. Can you please help as I am not sure how to fix it?
     
    Regards
     
    Barry
     
    Error
    SQL query:
     
    UPDATE wp_posts SET post_content=(REPLACE (post_content, '<cantseeitall.com>','<canseeitall.com>'))

     
    MySQL said: 
    #1146 - Table 'canseeit_wp_jxg2.wp_posts' doesn't exist 

    1. Hello Barry,

      If you look at the code at the top, the “<>” is not used around the domain names. Remove that from your code and then try again.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  21. transferred “non www” to “www” but images not appearing now. We did try resolving through permalink option but nothing happenned.

    It is a wordpress site and transfer is done by putting a code in .htaccess

    Please suggest to resolve issue.

    1. Look in your WordPress settings and be sure to update the Site URL accordingly. If that doesn’t work you may need to do a find and replace in the database.

  22. Great tutorial. but u should say that if u change the root name (for example from “siteA/” to “siteB/” ,

    u need to change it in the htaccess file too…

     

    before I did it, just the homepage worked…

     

    Thanks.

  23. • I’m going to be transferring my current WordPress Site to InMotion and was wondering about this last step… “Be sure to replace <old_url> with the old sitename and <new_url> with the new site name

    The <old_url> old sitename and the <new_url> new site name will be the same once I point the DNS to InMotion. So, should I use the Temp URL for the New Site as the <new_url> new site name?

    Sorry if confusing!

    Thanks

  24. Hi, this was very helpful for images broken links but I’m having the same problem with the logo image and this tip didn’t work for the logo. Do you have any suggestion? I’m stuck.

    Thanks

    1. JC, is the logo not loading due to a migration, or some other reason? Does the image file exist in the database, or is it supposed to be located on the file system directly( i.e. should there be an image file in your user folder )?

  25. Thanks for woderfull article , i have an errror , after moving site to another server some of my images show broken link. Pls guide me what can i do??

    1. Hello Avtar,

      If you have problems on your site, please indicate the URLs or the location of the problem and we can take a look at the issue.

      If you have any further questions, please let us know.

      Kindest regards,
      Arnel C.

  26. Your solution worked perfect! I appreciate people who take the time to provide their advice online, so folks like me can find answers without wasting time and money.  You’re do a great service here!

  27. my website url in the settings was https://localhost only. I followed method 2 of the below link
    https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

    Now the website is appearing with broken images , no structure for the contents of the site -everything comes one after the other(like archives, comments,recent posts sections)

    1. It is possible that the old URLs are still present in the database and will need to be replaced with the new URL.

  28. I migrated my website from localhost to a remote server, but I cannot see the images. When I leave all the links on localhost everything is OK.

    1. It is likely that all the links on the site are still configured for the localhost in the database. You will need to update those using the process above, or using your favorite file management method.

  29. Hello I have this problem, none of my images are showing up on my website after migration. The website is www.thenomadwolf.com and there is what I find when I inspect the page: <img src=”” alt=”logo” width=”0″ height=”0″ class=”img-responsive”> there is not even a src… do you have any idea about this? 

     

    Thank you. 

    1. We are happy to help you troubleshoot, but when we test your site we are seeing an empty folder. Could you please provide some additional information or links to the site with the missing images?

      Thank you,
      John-Paul

  30. Hi, yes i used a plugin… now all my images was on i0.wp.com/myweb/…. or i1.wp.com/myweb/…. i2.wp.com/myweb/….

    how i can solve it?

    thanks

  31. I’m currently learning backing up all my wordpress files to my localhost. I was worried about all the image links inside my posts. Apparently going directly to the database is the only way to go. Thank you for the SQL Query!

  32. Sudhakar asked:

    Hi there, I don’t understand what do you mean by old site and new site in you instructions – “Be sure to replace <old_url> with the old sitename and <new_url> with the new site name. For instance, our original site was inmotiontesting.com and the new test site will be at test.inmotiontesting.com”    

    I am not changing to a new site. I am just moving the same site to Inmotion. For example my site www.abcd.com  will be www.abcd.com with you. Please clarify . 

    But your response is not solving the problem as all I need is to get back my site images since it’s the same site and there are no new images.

    Thank you.

    1. If the domain and URLs did not change then there may be another reason for the non-appearance of the images. You may want to check the contents of the “uploads” folder to make sure the images came over in the transfer process.

  33. I ran this query after moving my test site to production, since all my images were missing. The query executed successfully, or so it said. But only about 100 lines out of 1400 (or so) were changed. I can browse through the tables, and still see hundreds of lines where my old test site URL is present. 

    If I run the query again, I get the message that 0 lines were affected. 
    How can I get the query to change all the post content, and not just the first 100?

    1. That query has no restrictions for the number of rows affected. Go ahead and try it again. Another option is to export the table to a text editor and do a ‘replace’ for the old links to change over to the new link.

  34. hey.thanks for your perfect article i just changed all images Urls in my posts by the way explained above but i still have another problem. the tip only changes the post content images and i wanna change thumbnails too! and i just wanna change it from phpmyadmin but dont know which row or table should i choose to use the code you told and do the replacement.

  35. Thank you Tim S for your response.

    So, this was the only reason I could figure that my images were not showing up in the Temp URL. If the domain name is the same as before, what am I missing? Any ideas?

    1. If you have updated the links with the URL, have you also reset the permalinks for the site? WordPress automatically changes links to the latest URL when the update is completed. Check out how to reset permalinks.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  36. This is what Am getting when I run

    0 row(s) affected. ( Query took 0.0390 sec )

    UPDATE wp_posts SET post_content = ( REPLACE( post_content, '<https://localhost/hcs>', '<https://hcs.edu.na>' ) ) ;

    1. Hello Cosy,

      Sorry you’re having problems with the query. If you’re getting 0 rows affected then you either having nothing to update, OR there’s something different with the qualifying portion of query. This means that whatever you’re searching for is NOT matching with your query statement. This could be caused by a misspelling, or mis-identification of what needs to change. Also, make sure that your table name is the same. Sometimes, people change the prefix from “wp” to something else.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  37. When I run the query, Am getting the message that (0) rows affected but I still have the problem and when I go to the columns I still find the localhost link. Please help

  38. Hi there, I don’t understand what do you mean by old site and new site in you instructions – “Be sure to replace <old_url> with the old sitename and <new_url> with the new site name. For instance, our original site was inmotiontesting.com and the new test site will be at test.inmotiontesting.com”    

    I am not changing to a new site. I am just moving the same site to Inmotion. For example my site www.abcd.com  will be www.abcd.com with you. Please clarify . 

    Thank you. 

    1. As noted in yellow above “this step is not mandatory. It is only necessary if your domain name is changing during the migration.

      Typically, when people migrate sites they also change the URL. If you are not changing your site name or having image link problems this guide may not apply to you your case.

      Thank you,
      John-Paul

  39. Ok so I followed the instructions and am coming up with this: 

    #1146 – Table ‘peacechr_test.wp_posts’ doesn’t exist 

    I really know pretty next to nothing so I’m unsure how to fix this. any help is appreciated.

    1. Hello Paula,

      Sorry for the problem with the SQL query correcting your image links. We need a little more information in order to investigate the problem that you are having. Can you please provide us the exact steps you’re taking that lead to this error? Also, if you are an InMotion Hosting customer, please provide us a domain name so that we can look into it further. The wp_posts table is a required table by WordPress, so it must exist. If you are getting this error, it’s either an incorrect reference to the table due to the prefix, the database is missing the file, or your database structure is different and the file isn’t located where it would normally be. Make sure to look at your WordPress tables in phpAdmin (or another MySQL client) and make sure that the table is being referenced correctly.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  40. Hi Sir…

    Can solve my problem..?

    My images url Start with https://**.com/*******.com…

    why not show my domain name url https://www.********.com /—— .Jpg

  41. Do you have any idea why I’d be getting this error?
    Error
    SQL query:
     
    UPDATE wp_posts SET post_content = replace(post_content, 'https://www.thefreebieaddiction.com', 'https://www.momlifeinpnw.com')

    MySQL said: 
    #1146 - Table 'thefrem7_wordpress651.wp_posts' doesn't exist
     

    1. It looks like MySQL is having trouble finding the table for the WordPress posts. It is possible the table was deleted, or the WordPress tables were not imported into the database.

  42. Hey I saw your article and I follwed the same. I have used that SQL query too. The problem with my site is it is showing all the images except logo. The image source for logo file is still pointing to localhost than my current live site.

    </div>

     

    1. Hello Sneha,

      Sorry for the problem with the graphic. I would suggest that you get the original graphic file for the logo and re-upload it into the media library for your installation. The link is definitely wrong – you will need to correct it or remove and re-add it in order to make sure that the logo is correctly referenced. It definitely can’t have the current path you’re using as it doesn’t work on the internet.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  43. Hi TJ

     

    Thanks for the feedback, you’re correct,I have checked the table and I see now that when I open phpMyAdmin and navigate to the SQL tab is already populates with the following command: 

    SELECT * FROM `wpwp_huge_itportfolio_images` WHERE 1

    My images are held in that portfolio on the main site, what would I need to do to re-direct them to the test site?

     

    Thanks again

    1. You would use the same script above as a template, but switch the table name and column name to reflect what the plugin uses.

  44. Hi I just followed your steps and have managed to create a test site successfully, however the images on my products pull through to the main site. I am using a plug in to house the images, what syntax should I be using if I have a third party plug in housing my product images?

    This is my error message: #1054 – Unknown column ‘post_content’ in ‘field list’

    Thanks in advance

    1. Hello Justin,

      Pretty much the error is stating there is no column called post_content in the table you are pulling data from. Please check your table to make sure it is there and you may need to repair your database which can be done via the cPanel.

      Best Regards,
      TJ Edens

  45. My old site address is the same as my new one. I did this now images I add to the site are broken. How do I fix this?

    1. Ideally, if the site URL is the same, then the URLs for the images would remain the same as well. Check to make sure the images are on the server. Also, do you have a URL example to the new site so we can take a look for you?

  46. Hello I just followed your this procedure but “ 0 rows affected. (Query took 0.0781 sec)“. What esle should I try here to fix my issue. 

     

    (My hosting is with godaddy just to let you know. My old domain which was redirected to my new domain expired recently and this images url issues occurs from that time. 

    1. Hello Alok,

      When you ran the command did you specify your correct prefix as even though wp_ is the default it may not be correct for you.

      Best Regards,
      TJ Edens

  47. HI, it’s all sorted. It wouldn’t work, so I had to redo the website a bit (used XML site, imported to a fresh new WordPress and made some changes) after that everything works. So happy I backed up the site pfff… 

    1. This is similar to a question above, but I just want to clarify – I am transferring a WordPress site from my own computer, where the url displays as localhost/wordpress/ – I would use this as the old url?

    2. Yes, you would just make sure you change all instances of localhost/ in your database with the new domain. If done correctly the site will function as expected.

  48. Hi, I am trying to move my wordpress website from one domain to another and I did the changed to the options table and to the posts table (sql query). It went OK, got message so many rows affected, However, the images still point to the oldsite.com. Is there anything else I can do? Thank you.

    1. Hello Katie,

      I regret to hear that the above steps didn’t work for you. Have you tried editing the database manually to see if the changes take effect?

  49. after going through your tutorial, i was pleased with the way your detailed  and how easy you made it looks, but unfortunately it did not work for me as i keeping getting the bellow errors
    Error
    SQL query:
     
    UPDATE wp_post SET post_content=(REPLACE_content,'predictiontips.com/wordpress','predictiontips.com'))

    MySQL said:
    #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

    1. Hello Mike,

      Sorry for the problems with the replacement code. Your error indicates that you have a syntax issue in the code you typed. SQL is unfortunately not forgiving in its need for punctuation and proper spacing. Check out the original code:

      UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘‘,’‘));

      Then here is your code:

      UPDATE wp_post SET post_content (REPLACE_content,’predictiontips.com/wordpress’,’predictiontips.com’))

      You’re missing the ‘post_content’ and the also the parentheses are not correct. Copy the original code syntax and the query should work with no errors.

      If you have any further questions or comments, please let us know.

      Regards,
      Arnel C.

  50. So just to clarify…if I do this procedure for other tables it would look like this? TIA.

    UPDATE wp_<some_table> SET post_content=(REPLACE (post_content, ‘<old url>’,'<new url>’));
    1. Hello Amy,

      Thank you for contacting us. Yes, your query looks correct.

      If yo have any further questions, feel free to post them below.

      Thank you,
      John-Paul

  51. Though i know basics of database/sql but still i was pretty scared after adding this sql query. but to my surprise it’s working fine. 
    thank you very much

  52. Site is alternating between the live version and the test version. Not sure what went wrong. Can anyone help pls?

    1. You can view the database tables via the phpmyadmin tool. Click on the database name and you will see them in a list. The table has to exist or your site will not work so it is there.

  53. Hi, I am trying to migrate from a WP site on my local computer to my temp url at inmotionhosting. I tried plugging in what i thought was the old url (localhost/wp) and the new temp url into the code, but nothing seems to happen. (Message is a green checkmark but says “0 rows affected.”) I am also having problems with one of the permalinks in my main menu. What am I doing wrong?

  54. thanks.. it solved my problem.. any way, is it ok to export the database.sql then find and replace the old url with the new one, then import it again ?

    i have tried once.. but it shows error like this :

    Error

    SQL query:


    — Dumping data for table `wp_comments`

    INSERT INTO `wp_comments` (`comment_ID`, `comment_post_ID`, `comment_author`, `comment_author_email`, `comment_author_url`, `comment_author_IP`, `comment_date`, `comment_date_gmt`, `comment_content`, `comment_karma`, `comment_approved`, `comment_agent`, `comment_type`, `comment_parent`, `user_id`) VALUES
    (1, 1, ‘Mr WordPress’, ”, ‘https://wordpress.org/’, ”, ‘2014-09-16 17:32:31’, ‘2014-09-16 17:32:31’, ‘Hi, this is a comment.\nTo delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.’, 0, ‘post-trashed’, ”, ”, 0, 0);

    MySQL said: Documentation
     #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’

     

    Thanks again..

    1. Hello Pinpin,

      Yes, you can export and then make changes to the file and import it again. That is certainly another option.

      Kindest Regards,
      Scott M

  55. Will it work if my old site is from a localhost, localhost:8888/wordpress? Tried it but it is not working.

    1. Hello Elliot,

      Thank you for your question. Yes, it should still work. Essentially, it is just performing a find & replace in your database.

      Thank you,
      John-Paul

  56. Good day, i tried it but i keep getting this      #1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘UPDATE wp_posts SET post_content=(REPLACE (post_content, ‘localhost:81/impgaller’ at line 2  

        the images are linked to my local host because i built it locally now its online and i cant change the links. Help

    1. Hello Steevy,

      Thanks for contacting us about your error. Does the error message give the complete query? The replace statement appears to be incomplete and would give that type of error if run in that fashion. Be sure it has a second parameter with the new location for the images and closes out with double parentheses, like )).

      Kindest Regards,
      Scott M

  57. Hi, thank you for your article. thats really helpfull for me. I just updated mine 1000+ images links. Wishing you very best of luck for your business.

  58. Thanks for the tip but that only changes the image link and not the URL the image is linked to which can be either an attachment, image or custom URL.

    1. Hello Sam,

      As a general replace query, it will replace all URLs of the set type to the new one, but specifically in the post_content column on the wp_poststable. If you need to replace URLs in other columns or tables, you would use the same type of query, but for that particular table/column combination.

      Kindest Regards,
      Scott M

  59. I followed the instructions concerning image links after migration,  however the images are still not being loaded when viewed in browsers. Can you offer any other instructions to assist?

    1. Hello Rexford,

      Right click on one of the missing images and get the image information from the menu there. This will include the URL where the program is looking for the image. Check to see that it is correct. If not, then run through the above again to change the URL. If it is still occurring we may need to take a look at files your account if you are one of our customers to see where the settings are incorrect.

      Kindest Regards,
      Scott M

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+