Ninja Form on WordPress get post_id value on my_ninja_forms_after_submission

434 views Asked by At

I created a form that create a specific post type and everything is working well but, based on this form, I want to set up some tags I use for filters. The creation part works well but the 'wp_set_object_terms' is not working as, has I call 'my_ninja_forms_after_submission' and set up my method, the only post_id I got from $form_data is not the right one. Checking my 'posts' table in the db I discovered that, on submit, I got 4 different row created, probably for the form structure and content but calling $post_id = $form_data['actions']['save']['sub_id'] on 'my_ninja_forms_after_submission' I got only the last ID of the 4 row. Has you can see in the screen I took, I got the id pointed with the red harrow instead of the blue one.

enter image description here

Anyone has experience about that and know I can get the right post_id value?

Many thanks

0

There are 0 answers