Tet banner

Custom Fields
Support General Dynamic Post Select Based on Post Type Selection

  • Creator
  • #19117
    Resolved Pea

    I'm looking to create a metabox with 2 select fields:

    1) Post Type select
    2) Post select, based on Post Type selected

    Essentially, I'd like to limit the posts available to select (2nd field) to the post type selected in the first field (1st field).

    So, I'm wondering if I can use JS to modify the post selector query_args somehow?

    Hope this is clear. Thanks!

Viewing 1 replies (of 1 total)
  • Author
  • #19122
    Long Nguyen


    Thank you for contacting us.

    Because the post types for each site are not too many and Meta Box supports the field Post to list the posts by post type so I think this case you can create 2 fields Select and Post then combine with Conditional Logic extension to limit the posts available.

    1. Create a Select field with a list of post type
    2. Show the Post field with selected post type when selecting that post type.

    Here is the sample code https://pastebin.com/hRBiRTiW
    and a short screen record to do this case with MB Builder https://www.loom.com/share/b32c8474f2134198af30abd186e6348e

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.