0

Alright - so I was missing a bunch of 'featured images' so I did a DB delete of a bunch of postmeta rows with the meta_key = "_thumbnail_id". Unfortunately, my query was a little greedier than I thought.

So I restored the rows that I deleted (I backed up those specific rows) but the thumbnails have not returned.

I'm no wordpress master, so I'm wondering if there is something else that I need to restore to get those references back.

5
  • It's not really clear which the problem is. Thumbnails reference are not in DB? They are but the images are not shown? Are you sure that post rows referenced in _thumbnail_id exist? Are you sure that the images exists in the path they are supposed to be?
    – gmazzap
    Commented Sep 22, 2016 at 0:03
  • @gmazzap So I deleted rows with the meta_key of "_thumbnail_id". I restored those rows exactly, but now the features images no longer appear to be attached to the original posts. That make sense?
    – matmer
    Commented Sep 22, 2016 at 0:09
  • The value of "thumbnail_id" is the ID of a row in the _posts table. Even if the rows with the meta_key "_thumbnail_id" are there, if the post rows are not there, WordPress can't show the images. Also, are you sure tha tthe images are physically in the path?
    – gmazzap
    Commented Sep 22, 2016 at 0:13
  • yes, positive the images are still in the path. Are there foreign keys that cause posts to be deleted automatically? Otherwise, they should still be there, right?
    – matmer
    Commented Sep 22, 2016 at 0:17
  • @gmazzap just verified that the posts referenced still exist. But still no 'featured image'
    – matmer
    Commented Sep 22, 2016 at 0:19

1 Answer 1

0

I figured it out. Somehow in the import process a trailing space was added to the meta_key (making it "_thumbnail_id "). Mysql apparently matches on a trailing space which is why it wasn't apparent, but once I removed the space all featured images started showing again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.