Update Links in WordPress with PHPMyAdmin


Often times during site migrations you may need to do bulk updates to links or other content to many pages at once.  Using phpmyadmin is a great way to accomplish this.

A general snippet would be:

UPDATE wp_posts SET post_content = REPLACE(post_content, 'whatyouhave', 'whatyouwant')

For example,
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://', 'https://')

Would update all http links to https links


UPDATE wp_posts SET post_content = REPLACE(post_content, '/subdomain/sub2/', '/newdomain/new2/')

Would update urls from one path to another.

WordPress Upload and Import Images – Woocommerce Migration


During a recent migration from a hosted ecommerce solution to woocommerce we had to move a large number of product images.  With a combination of the woocommerce csv export and csv import modules moving large numbers of products is quite easy.  That’s for the data.

For the graphics you cannot just upload graphics into the wordpress media library and have them immediately recognized so you need to do a few things first.

  1. Using your sftp program – upload your image files to /wp-content/uploads/subdirectory
  2. Install and activate the “Add From Server” plugin
  3. Go to ->media->add from server and navigate to your “subdirectory” that has your uploaded images
  4. Then select all the images and click “import”

Then all of your images will be uploaded to the “uploads/subdirectory” directory.

That’s not all, however, if you are using these images in woocommerce products.  You then need to regenerate the thumbnails so…

  1. Install and activate the “Regenerate Thumbnails” plugin
  2. Go to ->tools->Regen. Thumbnails and click to regenerate the thumbnails.

At this point all your images are ready to use.