WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Contact Form 7] Add action to the additional settings

[Plugin: Contact Form 7] Add action to the additional settings

  • I am wanting to add the following action/hook to the addition settings box on the contact form 7 plugin:

    add_action( 'wpcf7_before_send_mail', 'wpcf7_callback' );

    I cannot get this working at all.

    On submit of the form i would like the function “wpcf7_callback” to trigger and thought this would be the way. I cannot put this add_action in the functions.php file as i need to call a different functions for different forms throughout the site.

    Does anyone have any suggestions?

Viewing 1 replies (of 1 total)
  • don’t know if i understand well but you can put this add_action in the function.php file, and lookup the form title to switch to different action

    function wpcf7_before_action($cfdata) {
    	$formtitle = $cfdata->title;
    
    	if ( $formtitle == 'name-of-your-form') {
             //do action for this form
    	}
    if ( $formtitle == 'name-of-your-form') {
             //do action for this form
    	}
    
    }
    add_action('wpcf7_before_send_mail', 'wpcf7_before_action',1);
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Contact Form 7] Add action to the additional settings’ is closed to new replies.