Support » Plugin: Advanced Custom Fields: Extended » Use the value of a relationship field in title

  • Resolved laymonk

    (@laymonk)


    Hi,

    I am trying to auto-generate titles for a CPT based on the concatenation of the value of a text field and the value of a relationship field.

    However, I get an array for the relationship field, and even using acf_log() to print this to the debug log doesn’t show the structure of the array (so, I can try to dereference into it).

    It doesn’t make any difference whether I choose Post Object or Post ID in the Return Format of the relationship field definition.

    I have seen these ACF help pages, but it’s not clear how I can use either filter described:

    It’s noteworthy than when filling out the form, the relationship field displays a list of the values of the relationship field, from where a choice is made

    • This topic was modified 1 month, 4 weeks ago by laymonk.
Viewing 1 replies (of 1 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    I would recommend to generate the post title using PHP in such advanced case, so you can concatenate any fields values and have the exact output you want.

    You can achieve that using the acfe/form/submit/post_args hook, as it let you change the newly created/udpated post right before it is updated. See documentation.

    Hope it helps!

    Have a nice day!

    Regards.

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