• Hi, I want to update the WPCF7 form success message.

    I need to do it using PHP because I’m using that to generate a WooCommerce coupon on form submission. That’s all working. Now I need to update the form success message to include that generated coupon code.

    Below is my 15th ( clumsy ) attempt.

    add_filter('wpcf7_before_send_mail','dbo_update_form_message',10,1);
    
    function dbo_update_form_message($messages){
    	$messages = array(
    		'mail_sent_ok' => array(
    			'description'
    				=> __( "Sender's message was sent successfully", 'contact-form-7' ),
    			'default'
    				=> __( "Thank you for your message. It has been sent.", 'contact-form-7' ),
    		),
        );
        return $messages;
    
    }

    I’ve also tried
    add_filter('wpcf7_mail_sent','dbo_update_form_message',10,1);
    and
    add_filter(wpcf7_messages,'dbo_update_form_message',10,1);

    clearly I need help.

    Thanks in advance

  • The topic ‘Custom success message’ is closed to new replies.