i have 3 custom post type : artists, songs, videos songs and videos have a meta that sort artist id of songs or videos filter in rest api couldn't return filtered post by artist id custom meta

so i have to return that by custom function and show it in rest api

how create a function that compare value of artist id meta and return post that have specific artist id ?

something like this : /wp-json/wp/v2/songs?artist=4438 that return songs that meta value of artist is 4438


1 Answer 1


I mean you need to query by your custom taxonomy (eg. songs_categories, or whatever you named it in your register_taxonomy() function) and then by the term.


PS: In my context I filter via custom filter, a plugin that enhance the API. You find all information on the repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.