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.

Hook Syntax Help

  1. Hello,

    Could you please help me with the correct syntax for using the hook.

    1	add_filter('gform_field_value_your_parameter', 'my_custom_population_function');
    2	function my_custom_population_function($value){
    3	    return 'boom!';
    4	}

    My form ID is 15, field_ID 11 and parameter name: page_name

    I would like to always return the current post title in the page_name parameter

    I have already setup this up to populate dynamically.

    many thanks,
    Andy

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  2. David Peralty

    add_filter('gform_field_value_page_name', 'page_name_filler');
    	function page_name_filler($value){
                //this is where you'd put your PHP code for grabbing the current post title.
    	    return 'boom!'; //return the variable or value to the field.
    	}
    Posted 11 years ago on Friday February 22, 2013 | Permalink
  3. thanks David, but don't i need to specify the form ID and the field ID anywhere? ??

    Posted 11 years ago on Friday February 22, 2013 | Permalink
  4. i have used:

    add_filter('gform_field_value_page_name', 'page_name_filler');
    	function page_name_filler($value){
                //this is where you'd put your PHP code for grabbing the current post title.
    	    echo get_the_title(); //return the variable or value to the field.
    	}

    but nothing gets returned.. is my syntax wrong?

    Posted 11 years ago on Monday February 25, 2013 | Permalink
  5. You should be using return rather than echo on line 4, otherwise your function won't return anything.

    Posted 11 years ago on Tuesday February 26, 2013 | Permalink