• Resolved Alex Barron

    (@rosalindmundie)


    I am using the wpcf7submit javascript DOM event which contains the data submitted in the CF7 form.
    I need the ID of the post created when submitting the form. How can I obtain that? Preferably in the AJAX response.

    Thank you in advance!

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

    (@aurovrata)

    Unfortunately CF7 plugin does not allow data to be injected into the AJAX stream at the response time.

    One way to get the post ID is to redirect your form to another page and access the submitted ID on that page (see FAQ #1)

    If you really need the ID in the same page, then you will need to implement your own AJAX service to retrieve it once submission is successful.

    Thread Starter Alex Barron

    (@rosalindmundie)

    Ok thank you for the fast and clear reply!

    Plugin Author Aurovrata Venet

    (@aurovrata)

    are you using the Smart Grid plugin as well? It has a hook that allows you to customise the response message and include HTML code (which normally is stripped by CF7, god knows why!), so you could also use that functionality to add the post ID as an HTML attribute on your own success message and then read it with a js script.

    Thread Starter Alex Barron

    (@rosalindmundie)

    No I’m not. I wrote my own AJAX code and PHP in the end.
    Thank you.

    Plugin Author Aurovrata Venet

    (@aurovrata)

    no worries

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I get the ID of the created post?’ is closed to new replies.