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.

How to prepopulate a field from a custom field?

  1. Hi All

    I hope someone can help me with a solution on this topic.
    I really really want my form too have pre-populated fields and the fields should be map with a custom field. The form will get the custom field value from wordpress and display it for the form user as ex. a dropdown, multiselect or html...

    it is like the "Gravity Forms + Custom Post Types" plugin but for custom fields...?

    Posted 12 years ago on Wednesday February 8, 2012 | Permalink
  2. Here is a walk through for populating the Post Author. You can use this same concept to populate a custom field. Just use the get_post_meta() function instead of the get_the_author_meta() function used in the walk through.

    http://www.gravityhelp.com/documentation/page/Dynamically_Populating_the_Post_Author

    Posted 12 years ago on Monday February 13, 2012 | Permalink
  3. Hi David

    Thank you for your reply. I found a custom field/custom post plugin:
    "Ultimate Post Type Manager"

    Here I can make the metadata I want on custom posts.
    1. Make a custom post type "product"
    2. Make fields for details like price and different configuration variants.

    Now I would like to make the orderform which get the metadata from the different posts and their configurations...

    The "GravityForm+custom field" enable a dropdown for population so that I can get the "product" post type. Now I am just missing the get "custom field" function.

    And I guess your ex. with post_author could work but I cant seem to rewrite to make it work...help

    Posted 12 years ago on Thursday February 16, 2012 | Permalink
  4. Hi Jesper,

    Based on the Post Author example above, this code will retrieve a post custom field:

    http://pastie.org/3395597

    Make sure you re-read the Post Author example documentation as it provide additional explanation on what is going on here.

    Posted 12 years ago on Thursday February 16, 2012 | Permalink
  5. Hi David
    Almost.

    Can you check the code here:
    http://www.pastie.org/3443468

    Is the $post->post_32 part wrong?
    The parameter in the form is called "pris_in" and the custom field is "pris"

    Posted 12 years ago on Friday February 24, 2012 | Permalink