Recently I changed some code that had an empty value in the post ID. That made the function unable to set a featured image in the current post. What ended up happening was the most recent image got set as the featured post for EVERY POST, on EVERY update. Oops.

Here is a snippet to fix the problem:

Not sure what happened to the code…