different "on email sent" function per according form
-
I have two diferents form, each one with a counter.
The counters adds +1 number everytime any form is sent with a function add_action(‘wpcf7_mail_sent’…..The problem is both counters increaces by 1 on any form sent.
I created a function in order each form triggers a different counter adds like this. But it’s not working.add_action( ‘wpcf7_mail_sent’, ‘your_wpcf7_mail_sent_function’ );
function your_wpcf7_mail_sent_function( $contact_form ) {
$title = $contact_form->title;if ( ‘Application Form’ == $title ) {
add_action(‘wpcf7_mail_sent’, ‘cf7dtx_increment_mail_counter2’);
} elseif
( ‘TALK_ES’ == $title )
{
add_action(‘wpcf7_mail_sent’, ‘cf7dtx_increment_mail_counter’);} //endif
}Both funcions cf7dtx_increment_mail_counter and cf7dtx_increment_mail_counter2 works fine if triggered alone with add_action(‘wpcf7_mail_sent’, ‘cf7dtx_increment_mail_counter2’);
But they don’t work inside the code aboveThanks for your help.
The topic ‘different "on email sent" function per according form’ is closed to new replies.