Support

Account

Home Forums Front-end Issues Can I pass the title from a CPT post to the front-end form?

Solving

Can I pass the title from a CPT post to the front-end form?

  • I’ve got 2x CPT – ‘pre-jobs’ and ‘quotes’ which are connected via a relationship field ‘linked_pre_job’

    What I’d like to do is have a link on the pre-job post; ‘add new quote’ that takes the user to the ‘quote’ CPT front end form, which automatically links the two instead of relying on the user to make the connection (which I’m sure will increase the chance of user errors).

    I thought about passing the pre-job title into the ‘linked_pre_job’ field and hiding that from the end user, but I’m not too sure about how to go about it, I’m not too familiar using GET & if anyone can point me in the right direction that would be great.

  • I’m assuming that each quotes post will have a number of pre-jobs posts selected under the linked_pre_job relationship field.

    So in order to make the connection from the quotes post, you’ll need to search through those fields in each of the pre-jobs posts to make a match with your current quotes post. You’re essentially reversing how things typically work, you’d probably call this a reverse relationship query.

    If I’ve interpreted the question correctly, it looks like someone has done exactly this on this question:

    https://support.advancedcustomfields.com/forums/topic/reverse-relationship-query/

    Good luck, I hope I’ve helped.

  • No really but thanks for your response, always appreciated.

    What I’m trying to do is pre-populate the relationship field so that on the front-end form of the quotes page, it already has the pre-job page connected to it, so that the user doesn’t have to search and click the wrong one by mistake.

  • So how is the pre-job page connected to the relevant quotes page?

Viewing 4 posts - 1 through 4 (of 4 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.