I can populate post author email with this code:

add_filter('gform_field_value_author_email', 'populate_post_author_email');
function populate_post_author_email($value){
    global $post;

    $author_email = get_the_author_meta('email', $post->post_author);

    return $author_email;

It's ok, but how i can populate meta of post? meta = imail

I'm trying with

add_filter('gform_field_value_meta_imail', 'populate_post_meta_imail');
function populate_post_meta_imail($value){
    global $post;

    $meta_imail = get_post_meta('imail', $post->post_id);

    return $meta_imail;

closed as off-topic by s_ha_dum, gmazzap, markratledge, kaiser, Wyck Jan 25 '14 at 19:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that are too localized (such as syntax errors, code with restricted access, hacked sites, hosting or support issues) are not in scope. See how do I ask a good question?" – s_ha_dum, gmazzap, markratledge, kaiser, Wyck
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Gravity Forms is commercial software, meaning that the source is unavailable to us and meaning that the question is off-topic. Contact the plugin's author. – s_ha_dum Jan 25 '14 at 15:49
  • @s_ha_dum this is not about gravity forms, is about get post_meta. And plugin-gravity-forms is a valid Tag – Vektor Unbreakable Jan 25 '14 at 16:30
  • And "code with restricted access" is an explicitly listed valid reason to close a question. – s_ha_dum Jan 25 '14 at 16:39
  • I don't understand good yet the rules of this site sorry. I'm spanish and i don't understand english very well. But i'm learning! – Vektor Unbreakable Jan 25 '14 at 21:40

You have the arguments for get_post_meta backwards. You have:

get_post_meta('imail', $post->post_id);

Whereas, where you to check the Codex, it should be:

get_post_meta( $post_id, $key, $single );

Or is your case:


That is assuming that $post is set correctly and that you are using the Gravity Forms hooks correctly.

Not the answer you're looking for? Browse other questions tagged or ask your own question.