Support » Plugin: Contact Form 7 » on_sent_ok depreceated

  • Hi,

    first of all i just wanted to thank you for developing such a nice plugin. I didn’t have any problems with it since few years.

    I am just concerned with upcoming depreciation of function ‘on_sent_ok’. I was using it on lot of projects to push some GA/FB events and trigger some DOM manipulation for confirmation messages etc.

    I saw that in 4.9 you are throwing out depreciation notice so i guess it is coming to an end.

    IMHO functions declared can’t be easily moved to DOM, it requires extra time to work on it. Also having on_sent_ok in dashboard is really helpfull solution for non-programmers to chnage some behaviors.

    My question is if could you add some filter/option to support this as legacy feature in next releases just by adding some non-default enabled option? I am aware of security-risk but it would be great to not be forced to convert lot of logic on site.

    So we could assume that with upcoming update you will disable it entirely and it will stop to work. But it would be great to be able to enable it in wp-config or functions.php like this:

    define ('WPCF7_on_sent_ok', true );

    I guess it’s better to not drop future updates just in favor to keep this option, and just be aware of potential security issues.


    • This topic was modified 2 years, 11 months ago by zychu69.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Takayuki Miyoshi


    Thanks. I’ll consider the idea. But you have four months until the end of the year. I think it’s better to replace them with alternative while you can.

    I also really need to keep the on_sent_ok hook like i stated here in the forums:

    @takayukister please leave the on_sent code in there โ€“ย many many users are relying on these hooks.

    Thanks so much for your great plugin โ€“ย Keep it great in future!

    Best regards,

    @takayukister PLEASE consider an easier way to redirect to another page/url with CF7. I too am not a programmer, so now trying to wrap my head around DOM stuff is making my head spin. The (on_sent_ok) was so easy for us non programmers to get our head around, but the alternative is not as simple.

    At the very least, please add on your documentation page ( for this being depreciated, the DOM code for a URL redirect.

    I haven’t found a CF7 add on plugin that handles external site redirects, which is what I need. ๐Ÿ™

    Edit: Ok, I found another of your pages that does explain the new url code ( but this solution does not work for me. Since this code has to go into the template file, that tells me this is a once size fits all thing. I have different forms that redirect to different URLs, some are external.

    Is there any way to tell this code to only perform that action with specific forms?

    EDIT TO THE EDIT: I just ran a test with a form on my site that uses the (on_sent_ok) method of url redirection. Even though you say it will still work till the end of the year, I have found that it doesn’t work now. My form no longer redirects after it’s submitted. I do get the submitted form via email, but the site no longer redirects. ๐Ÿ™ ๐Ÿ™ ๐Ÿ™

    • This reply was modified 2 years, 11 months ago by Esch.
    • This reply was modified 2 years, 11 months ago by Esch.


    I have used on_sent_ok in all my form for redirect to different URL.
    As @esch i’m also facing the same issue.all my form redirect to same URL.
    DOM event function is not practicable.please don’t remove the on_sent_ok option.

    i have the same issue, i mean i have a lot of forms email to different url .. if i use this snippet:
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    location = ‘;;
    }, false );

    this is valid for all forms and i don’t want this … i tried to put this script in cf7 additional settings but nothing cf7 don’t see it .. only in admin theme panel custom java script…


Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘on_sent_ok depreceated’ is closed to new replies.