Media Library API – Parent mapping missing
-
Hi,
We have a following query.
The limitation here is when we attach any attachment to Post or Page directly from desktop, we get the parent mapping in a response.For example
https://public-api.wordpress.com/wp/v2/sites/kendra905.wpcomstaging.com/media?per_page=100{
“media_details”: {
“filesize”: 26624,
“sizes”: []
},
“post”: 637,
}But when we attach it from the existing Media Library, we get the “post” as a null. So couldn’t find out the parent mapping.
{
“media_details”: {
“filesize”: 17,
“sizes”: []
},
“post”: null,
}Note: We are hitting the /media API, where we are checking the “post” key in a response to see if the attachment is being mapped with any post or page or not.
Please suggest.
The blog I need help with is: (visible only to logged in users)
-
Hello –
Thanks for writing to us. I see that y’all are set up with an eCommerce hosting plan. Were you able to reach out team over live chat to assist with these questions? I can see that you were in touch with them several days ago. If you still need help please go to https://wordpress.com/help/ to get connected to chat.
Of course, we are happy to assist in the forums if this is your preference but being asynchronous by nature it will take much longer.
-
Hi @staff_zinna,
Thank you for responding.
We had discussed this issue on a chat, a couple of days before, but unfortunately they were not aware about this issue and asked us to raise a question in a forum.
Please suggest the next steps.Thanks
-
If I understand correctly, the original suggestion was to ask in the WordPress.org forum (this is the WordPress.com forum, which is a related community to our Live Chat service which you used previously).
I should note: this is the inherent behaviour of the WordPress software. When you upload an image directly from your computer to a page or post, it will show in your Media library as “attached” indeed. But by default in WordPress, media which is uploaded first to the Media library and simply inserted into a page/post will not be attached.
That is why it returns “null” when you query the API.
There’s some information about that here:
https://wordpress.com/support/media/2/#unattached-filesFurther down in the guide linked above, you can see how to attach files that are shown as “unattached” in the Media library – you may need to do this directly within the WP Admin view of your Media library however.
This is similarly described in the support pages of WordPress.org too:
https://wordpress.org/support/article/media-library-screen/#filtering-options-2
- The topic ‘Media Library API – Parent mapping missing’ is closed to new replies.