• Resolved Sajid Manzoor

    (@sajiddesigner)


    Hello,
    I want to get ID of last created post and redirect it a page such as
    /thank-you?result_id=XXXX (where XXXX is the ID of newly created post on form submission).

    I checked in FAQs and there is an example which uses ‘cf7_2_post_form_append_output’ But I cannot use this. I will also need to send this Post ID to an API and I can not do this inside append_output filter.

    Here is an example of what I have used:

    add_action('cf7_2_post_form_submitted_to_cph_entry', 'form_redirect_results',10,4);
    function form_redirect_results($post_id, $cf7_form_data, $cf7form_key, $submitted_files){
    //do something.
    wp_safe_redirect( '/thank-you/?result_id='.$post_id, 302);
    exit;
    }

    Above code is creating a new request in network instead of redirecting to a page.

Viewing 1 replies (of 1 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Use the solution from FAQ #1

    I will also need to send this Post ID to an API and I can not do this inside append_output filter.

    do this on your actual redirect page

Viewing 1 replies (of 1 total)
  • The topic ‘Get ID of created post and redirect to page with id as query string parameter’ is closed to new replies.