media library – WordPress can’t get image url but both the attachment and the actual file are there


The following applies to all attchment images on my site:

There is a PNG image attachment, its ID is 519271.

wp_get_attachment_image(519271, 'thumbnail', false, array( 'id' => 'esjb-preview-image' )) returns “”.

So does wp_get_attachment_image_src(519271).

wp_attachment_is_image(519271) returns true

The file is there in the uploads folder. Folder permissions are 755. File permissions are 644.

The attachment is in the wp_posts table and the data seems to be OK.

The file has a proper thumbnail in the media library, but when I click on it and it opens the attachment details (/wp-admin/upload.php?item=519271), there’s no image there, just the default empty image icon. The details are correct though, including the actual file URL.

I tried deactivating all plugins (except the Really Simple SSL) to no effect.

I re-generated thumbnails using the Regenerate Thumbnails plugin, but the problem still exists.

The site has been hacked recently (WPCoreSys (Dolly) Hack), after which I deleted all files, changed my host password, then uploaded a clean WP, checked my database for any entries that do not belong there, so I presume WP core files are unchanged. The only folders I took from the hacked install were the uploads folder and my theme folder, but I made sure there are no corrupted files there. Anyway, I deactivated my current theme for a time and nothing changed.

Any ideas on what can cause the problem?

Artem 7 months 2022-10-29T08:50:29-05:00 0 Answers 0 views 0

Leave an answer