treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Wordpress Move to New Domain & Server. Image Thumbnail Fail.

  • So I migrated my Wordpress site from the staging domain to the actual site domain. Everything migrated just fine with no problem except for the image thumbnails on the bio pages for the artists. Can someone help troubleshoot this?

    Here's a page on the staging URL: http://studio7.greenflagseo.com/artists/dorothy-cavanagh/

    Here's the new page URL with the fail: http://www.studio7gallery.com/artists/dorothy-cavanagh/

    I migrated the site with the Wordpress Move plugin to assist me.

    Thanks!
  • The URL is wrong for the images.

    It's trying to hit:

    /home/content/54/9070554/html/wp-content/uploads/2012/02/Summer-Asters-Limes-117477_260x170.jpg

    Instead of:

    /wp-content/uploads/2012/02/Summer-Asters-Limes-117477_260x170.jpg

    The images have uploaded fine, you're just pointing to the wrong place. Try using Velvet Blues Update URLs to change them all: http://wordpress.org/extend/plugins/velvet-blues-update-urls/
  • Hey Doc,

    Thanks so much for pinpointing that problem, I feel dumb for missing it :).

    I'm not having any luck getting the Velvet Blues plugin to pick up any of my URLS, I tried a few variations. Do you know of any other methods to search and delete that string of characters in the URL that I don't want?

    Thanks!
  • You could go through phpMyAdmin, but I'm not 100% sure on the instructions.
  • Hmm...yea I've been trying to use the Search and Replace plugin for Wordpress which apparently allows you to do so. I'm just not sure where this actual URL string is located in the database table. I've read that images are saved in the wp_posts and the posts_metadata tables, but not exactly sure to manipulate them.

    If anyone is more familiar with MySQL please chime in!
  • Basic code

    <?php
    $your_db = 'your_db';
    $your_host = 'localhost';
    $your_access = 'root';
    $your_pass = 'password';

    $old = 'your/path/';
    $new = 'your/new/path/';

    $con = mysql_connect($your_host,$your_access,$your_password);
    mysql_select_db($your_db , $con);

    $get_all = mysql_query("SELECT * FROM your_table WHERE your_column LIKE '%$old%'");

    while($row = mysql_fetch_array($get_all))
    {
    mysql_query("UPDATE your_table SET your_colum=$new WHERE id = $row['id']");
    }
    ?>
  • Thanks for the help guys, I got it sorted out by doing a string replace in the image call of my customfunctions.php.

  • That's definitely not the way you should do it. Make sure to make the changes to your database!
  • Hmmm ok I'll have to do some more digging then. It's working fine now, but that might just be a hack so I'll have to ensure that the changes are made in the database.