The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
Hi I have added custom field in post entries that will record the IDs of the uploaded media.
from the JSON it is know that the list of media is stored in
wp-json/wp/v2/media?parent=[postID]
How should I fetch the media by ID, or convert to a proper fetch URL?
after that, should retrieve them with state.source.attachment[id]?
or any other more preferred methods?
thanks!
mburridge2
Hi @kvhk
Welcome to the forum. You can use the value stored at state.source.attachment[id].link.
Hope this helps.
1 Like
kvhk3
i did not able to get the media data by state.source.attachment[id].link . as the media has not been fetched.
I solve the complication by using pods framework plugin to get all the media data. thanks!
juanmtorrijos4
Hello everyone, I am having this same issue. I fetch all data for my categories using the beforeSSR hook and I get access to all the information but the media link. And the media link (featured image) is not on the state.
juanmtorrijos5
Hi again.
I am back answering my own question. What I finally did was to add the featured image source in the rest object by using the register_rest_field WordPress function.