Featured images disappeared

First of all thank you for creating Frontity, it’s fun.

I created a blog based on the mars-theme and was very happy until most problably a few days ago the featured images disappeared except on a page which was originally a page in wp. So no featured images in post and list-item.

After spending some hours this morning debugging everything I discovered was that for all the posts the state.source.attachment[id] is empty in featured-media.js althought id is not empty on entering the component.

So, I thought maybe I messed up. I installed a new clean project and did only this:

  • npx frontity create
  • switch source to my source
  • set featured to true, true in the frontity.settings.js

run it in dev mode and again only a featured image for the page, the rest is not available.

When I debugged my own project the settings for showing featured were true in the components so I have really no idea where to look and no idea what code to share.

I’m happy to share something if I know what, I hope somebody has an idea where to look for the problem.

best regards Marie-Anne

edit: I hate to ask questions like this. I switched back to the testdata and they were fine with images. I kept wondering what I changed besides updating (but no errors appeared) and that was unpublish the second post. And what I discovered, when there is one post with featured image, the image will not show whatever you try on a list or post (but on a page), when you publish a second one, all featured images on lists and posts reappear. I guess I have to search for the mars-theme problem or publish a second post.

2 Likes

Hi @marie-anne, do you mind sharing your REST API URL with us so we can inspect?

Goodmorning,

The rest api url is https://webwinkeleenvoud.nl/wp5, I’ve set the number of posts to 1 again, to make the problem visible.

best regards Marie-Anne

Hello @marie-anne,

Do you, by any chance, have a security plugin or something that can be limiting how the REST API shows images? Here is a screenshot of 401 (unauthorized) error on your Rest API Response:

https://webwinkeleenvoud.nl/wp5/wp-json/wp/v2/media/144

Hi @iamuchejude,

Thank you for looking into the thing. No, as far as I know not, there is no wp security plugin active or something like that.
Media item 144 is connected to a post in draft so it should be skipped. When I publish this post, you don’t get a 401 but the json data. If it is helpfull I can give you access to the backend. There is not much installed but maybe you see something I think is harmless.

best regards Marie-Anne

edit: media item 146 is connected to the page and does show jsondata

The only post I see on your site has (https://webwinkeleenvoud.nl/wp5/wp-json/wp/v2/posts?_embed=true) has a featured image that returns an error and therefore cannot be shown.

I’m sorry but we don’t understand the problem. Could you please describe it again?

If an attachment is attached to an unpublished post, the attachment won’t be shown in the REST API. I think this may be your problem, and that’s the reason why once you publish your second post, it shows. I guess it’s because the image you are trying to load is attached to the unpublished post.

1 Like

@SantosGuillamot , I followed your remark and first removed the same featured from a draft and when that didn’t work, removed all featured images from 3 drafts, still didn’t work. (removed server cache etc).

Long story short, when i removed the 3 drafts permantly the featured image from the published post reappeared immediately. When I added a draft with the same featured as the published post, it still worked. When I removed the featured image from this draft, the image disappeared from the pubished post again. When i added another featured image to the draft the featured image did not return on the published post.

I’m giving up on this one and hope I can remember not to mess with featured images. It’s not a Frontity problem. Thanks all for the replies.