Search code examples
phpwordpressninja-forms

Wordpress Ninja forms post process hook doesn't work


I'm trying run a simple function when form is submitted. I have my own simple plugin, which is activated, I've tried do to this from Wordpress admin panel, and setup WP HOOK in Ninja Forms plugin actions - but it didn't work either.

I've setup simple form with id = 2; Only checkbox and submit button. Only ninja_forms_after_form_display was called on init. When I've submitted form none of process hooks callbacks was activated.

Any idea what I'm doing wrong ?

function action_process_callback( $form_id ) {
    echo "action callback";
};

// add the action
add_action( 'ninja_forms_after_form_display', 'action_process_callback', 2 );


add_action( 'ninja_forms_pre_process', 'action_process_callback', 2);
add_action( 'ninja_forms_process', 'action_process_callback', 2 );
add_action( 'ninja_forms_post_process', 'action_process_callback', 2);


add_action( 'ninja_forms_processing', 'action_process_callback', 2 );

add_action( 'ninja_forms_after_submission', 'action_process_callback', 2 );

Solution

  • Maybe some of you would step up to the same problem. It turned out that any echo called by Ninja Forms using WP Hook is somehow 'silenced' by NinjaForms. Switching my debug method to error_log, showed that callback actually was called.