• Resolved imran5211

    (@imran5211)


    I am rendering Ninja Forms dynamically. By dynamically I mean the shortcode is coming from an ACF field, so at different pages, there would be different forms or multiple different/same forms on the same page. So it is like:

    
    if ($nf_shortcode && $a_condtion){
      echo do_shortcode($nf_shortcode); //Render Ninja Form
    }
    

    I am using ninja_forms_after_submission hook like this:

    add_action('ninja_forms_after_submission', 'my_ninja_forms_after_submission' );
    
    function my_ninja_forms_after_submission( $form_data ){
         $form_id = $form_data['form_id'];
         /*
         global $wp_query;
         $post_id = $post->ID; //This never returns a valid ID.
         */ 
    }
    

    $post_id in this block always return 0 or nothing. Tried get_queried_object_id() as well but no luck.
    Another issue is that within this function, wp_redirect() is not working. It is getting quite frustrating that why these basic functions are not working inside this hook callback.
    Any help would be appreciated.
    Thank you

    • This topic was modified 3 years ago by imran5211.
Viewing 1 replies (of 1 total)
  • Thread Starter imran5211

    (@imran5211)

    The way it is not available, it looks like it was intentionally done to make this hook useless?

Viewing 1 replies (of 1 total)
  • The topic ‘Unable to get post id inside ‘ninja_forms_after_submission’ callback’ is closed to new replies.