PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Pre-Populate a form field with refering post title

  1. davekusel
    Member

    Hi,

    I have a listing website and want to send users to an enquiry form with a field pre-populated with the post title. The are lots of listings so implementing a custom url for each enquiry link is not feasible. I know how to pre-populate the field with the referring url using {refer} . I would like to be able to pre-populate the field with the referring post title. The referring post's title is the element that would work best. Thanks in advance for any thoughts. Would be great if this can be done with existing wordpress hooks.

    Posted 13 years ago on Thursday October 6, 2011 | Permalink
  2. You would have to use PHP to do this. There aren't any built in options to do this.

    You would have to use PHP to get the referrer and then since the referrer is just a URL you would have to try and reverse look up the post ID and get the post title using the permalink. Then dynamically populate the field using PHP with the data you return.

    But the referrer would have to match the permalink in order for the look up to work.

    Posted 13 years ago on Thursday October 6, 2011 | Permalink