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.

Put Address Field Information into Custom Meta Field

  1. I'm building a directory and would prefer to use the default address input as opposed to using a custom field input for each section of the address. Would it be possible to take the information from the address field and stick it into a custom meta field, so I can display it and us it for google maps static image API.

    Any thoughts?

    Posted 11 years ago on Tuesday May 15, 2012 | Permalink
  2. ckrauskopf
    Member

    I am trying to do something similar. I need to call the address from a custom meta field, displayed on a custom post type created by the form submission, but I would much prefer to take advantage of all the built in validation from the address field when people are entering the address.

    Posted 11 years ago on Thursday June 28, 2012 | Permalink
  3. David Peralty

    The easiest way is to us the fields we provide for custom fields because our workaround would be taking values from the fields and putting them into hidden fields. There currently isn't an easy way to move values from normal input fields into WordPress fields.

    If you would like to know about moving values from one field into another hidden field, let me know. Then you still have your validation.

    Posted 11 years ago on Thursday June 28, 2012 | Permalink
  4. ckrauskopf
    Member

    Yes David, that would be very helpful.

    Actually, I think I have just now come across the solution from reading another thread on the forum, but maybe you can just tell me if I'm on the right track. My idea is:

    1) Create a "post custom field" for each component of the complex address field and hide them all by setting the visibility to admin only on the advanced tab.

    2) For each of these "post custom fields" I would then check the 'create content template' box, and select a merge tag value from the available address fields in the drop down.

    3) Once I have a hidden "post custom field" for each component field of the address field, I can select an existing custom field for each of those, and I can end up with city, state, country etc into separate custom meta fields this way, which is what I need.

    Is that what you would have suggested or is there another approach you would recommend?

    I'm pretty sure this approach should work but it is dependent on each component field of the complex address field having it's own merge tag. I was just trying to figure out a similar problem using the 'list' advanced field type, and it seems that each cell of the list field does not have it's own merge tag, so how might I approach that one?

    Thanks for your help.

    Posted 11 years ago on Tuesday July 3, 2012 | Permalink