Simplifying code to convert the string IDs that wp_get_object_terms gives us and converting them to the integers that wp_set_object_terms requires
Fixing bug with reversed ID arguments. Whoops.
If revisions are disabled, trash the replaced post so it isn't lost.