Home Forums General Issues Filter Post-Object Media by Media-Type


Filter Post-Object Media by Media-Type

  • [I’m not sure where to post this question best, so I went with ‘general’]

    I’m not sure, if I’m missing something, but I would like to offer my editors a filed to select post objects filternd by media type. I’m prepared to dig deeper, but I’m not entirely sure if I start at the right place, so some input would be welcome.

    I have videos and audios uploaded to the media library. For several reasons in this case I prefer to keep all relevant data in the WordPress standard way, including adding a post-thumbnail in the standard media editor.

    I want to use a flexible content field that (for now) gives the choice of adding either audio or video. The main thing to do for the editor is selecting the right media post object. So i created a field-type ‘post object’ (inside my layouts) and chose ‘Media’ as Filter by Post Type. But I would like to only have audio or video in my selection. Is there any (easy) way to accomplish that?
    Or ist there a totally different and better way to achieve what I want?

  • You create an acf/fields/post_object/query and you set $args['post_mime_type'] to an array of the allowed types. WP_Query Doc

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.