plugins – WordPress REST API: Query media files attached to a custom post type


I want to attach an React native app to a WordPress E-Learning Portal (leveraging the LearnPress-Plugin) to authenticate enrolled students and download audio assets of the course to the app.

The Plugin uses custom post types for courses & lessons.

So after authentication I use the Media Query to retreive the audio assets via Rest Media API

I want to retreive all media assets associated with a certain lesson Id, so I use the parent argument in the query:


I get empty results.

If I attach the media files to a regular wordpress post, the query works fine


So I guess the problem is that the lessons are custom post types?!

Do you have any solution or any workaround for this?

I could attach all needed media files to a regular post and query for them, but then I need to hardcode the post-id into the app, which I would like to avoid.

Thank you in advance!

Niklas D 1 year 2022-01-27T03:08:58-05:00 0 Answers 0 views 0

Leave an answer