I am trying to customize some gravity forms behavior. Therefore I've tried to hook into gforms from my theme. Unfortunately the form object is always NULL. Why is that the case?

Example code:

add_action('gform_confirmation', 'myCustom_gform_confirmation');
function myCustom_gform_confirmation($confirmation, $form) {

add_action('gform_after_submission', 'myCustom_gform_after_submission');
function myCustom_gform_after_submission($entry, $form) {

closed as off-topic by Johannes Pille, birgire, mrwweb, Pieter Goosen, Nicolai Sep 5 '14 at 11:16

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

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Johannes Pille, birgire, mrwweb, Pieter Goosen, Nicolai
If this question can be reworded to fit the rules in the help center, please edit the question.


By default, the add_action function is only going to pass 1 parameter, but you can define how many do you have / need

$accepted_args (int) (optional) The number of arguments the hooked function accepts. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run.

So change your code to this:

add_action('gform_confirmation', 'myCustom_gform_confirmation', 10, 4);
  • Yikes. That is a shame :( Even more so: Many thanks :) – SunnyRed Apr 14 '14 at 9:29

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