Support

Account

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

Helping

Filter Post-Object Media by Media-Type

    • iDad

    • March 5, 2021 at 3:33 am

    [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.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.