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.

Pass URL to form

  1. Hi,

    I found this code snippet here http://www.gravityhelp.com/forums/topic/use-postpage-title-for-subject.

    1- Add the Post Title field to your form
    a- Allow it to be populated dynamically (advanced tab)
    b- Type "posttitle" in the "parameter name" text field

    2- Add the following code snippet to your template's functions.php file

    [php]
    add_filter('gform_field_value_posttitle', 'populate_post_title');
    function populate_post_title(){
    global $post;
    return $post->post_title;
    }

    It works great, but I dont know how to get the post URL instead of post title. Can somewho I do that?

    Posted 11 years ago on Monday January 21, 2013 | Permalink
  2. Change line 4 to this:

    [php]
    return get_permalink($post->ID);
    Posted 11 years ago on Monday January 28, 2013 | Permalink