Prefill Custom fields from other custom fields in a different CPT

Support MB Group Prefill Custom fields from other custom fields in a different CPT

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #41214
    AndreAndre
    Participant

    I have two CPTs, MainContent, and Templates. The MainContent CPT has a clonable fields group. In that group, the user picks a template from a select field. The select field shows the elements from the Templates CPT via callback:get_my_templates. That works fine.

    My problem is, how can I prepopulate the other custom fields in the MainTemplate group with the values from the selected Template custom fields? Is there an option to define a dynamic default value in a custom field? I know I can define a static default. But I need the default taken from the Template CPT. Is there a filter or hook I could use?

    #41226
    PeterPeter
    Moderator

    Hello,

    There is no option to prefill the field value from another field after selecting the Template CPT. You can try to use the action hook rwmb_after_save_post to update the field value (post meta) after saving the post.

    Please follow the documentation https://docs.metabox.io/actions/rwmb-after-save-post/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.