• Hey All, I have had two separate sites where the images on posts and pages disappeared. They were there one day and then we made edits to a post/page and they were gone. Not all images, just some of them. What happened is that the post_type value for a media item was changed from attachment to page. I still don’t know why this happened. It could have been an issue resulting from the recent Yoast SEO fix, or maybe the change post type plugin, or something with Advanced Custom Fields since it was those fields that were losing their images. In any case, my fix for those was to run the below query. Hopefully this is able to help someone else. The gist of the query is that it looks for all posts that have a post_mime_type set. If it does, and it’s not set to an attachment post_type, then it makes the switch.

    update wp_posts set post_type = ‘attachment’ where post_mime_type like ‘image/%’ and post_type <> ‘attachment’;

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    maybe the change post type plugin,

    It sure sounds like that would be the cause.

    Thread Starter Martin Blumenfeld

    (@monkeypress)

    Yeah, that was my best guess. It definitely shouldn’t be jumping in like that if you aren’t specifically requesting to change a post type though. I’ll just have to wait and see if the issue pops up again.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disappearing Images Fix’ is closed to new replies.