Custom Field (Image – _wp_attached_file): Images not showing up
-
Hi,
I tried adding a Custom Field to the media library with the following settings:
Type: Custom Field
Field: _wp_attached_file
Field Type: Image
Image Size: Thumbnail (150 x 150)I want to add this field because the default thumbnails are too small in list mode.
The problem is that I get empty squares (with no images inside) in the media library.
If I inspect the missing images, I get something like this:
<img style="width:150px;height:150px" src="2021/12/image-name.jpg" alt="">
Since it is a relative link, it links to:
https://example.com/wp-admin/2021/12/image-name.jpgOf course, the link is incorrect, hence the missing image. It should be:
https://example.com/wp-content/uploads/2021/12/image-name.jpgOn the other hand, I have added a “Download” field just to test, and the links are OK. They are absolute URLs, not relative ones, like so:
https://example.com/wp-content/uploads/2021/12/image-name.jpgSo, there seems to be a bug due to relative URLs referring to “…/wp-admin/…” instead of “…/wp-content/uploads/…”.
I have tried on several sites with different themes, and I get the same issue.
I hope you can fix this.
Thank you in advance for your help.
- The topic ‘Custom Field (Image – _wp_attached_file): Images not showing up’ is closed to new replies.