Skip to content

Instantly share code, notes, and snippets.

@A5hleyRich
Created July 29, 2016 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A5hleyRich/1775e62d6f0294a30b1a040490c6c42c to your computer and use it in GitHub Desktop.
Save A5hleyRich/1775e62d6f0294a30b1a040490c6c42c to your computer and use it in GitHub Desktop.
$post_content_sql = "UPDATE $wpdb->posts SET `post_content` = replace(post_content, '{$pair['old_url']}', '{$pair['new_url']}'){$where_sql};";
$meta_content_sql = "UPDATE $wpdb->postmeta SET `meta_value` = replace(meta_value, '{$pair['old_url']}', '{$pair['new_url']}') WHERE `meta_key` IN ('tve_content_before_more', 'tve_save_post', 'tve_updated_post');";
// run the sql
$wpdb->query( $post_content_sql );
$wpdb->query( $meta_content_sql );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment