arminrosu / WP-Reset-Post-IDs

Reset Wordpress post ID's
4 stars 0 forks source link

No thumbnails are updated #1

Open BasTaller opened 7 years ago

BasTaller commented 7 years ago

While updating IDs thumbnails are not updated. To do so, you can add this code after _update wp_termrelationships with new id code:

        //if post's thumnail, update it too
        $result = $db->query('UPDATE '.WP_PREFIX.'postmeta SET meta_value='.$post_new_id.' WHERE meta_key="_thumbnail_id" AND meta_value='.$post_old_id.';');
        echo ($result ? "Updated ".WP_PREFIX."thumbnail for #".$post_old_id." \n" : "FAILED: \n".mysql_error()."\n");
arminrosu commented 7 years ago

Thanks for the code, I'll update it soon. Glad this repo is of use to someone :)