I need to do redirect in functions.php [closed]

If you’re using AJAX to submit your contact form 7 data ( which is turned on by default ) you won’t be able to redirect using the wpcf7_before_send_mail hook. You have a few other options though:

1) Turn off WPCF7 AJAX which is packaged into an entire JS flag. This will also turn off JS validation and all around not optimal. Documentation. Add this to wp config

define('WPCF7_LOAD_JS', false);

2) Use the built-in WPCF7 Additional Settings Field field on your contact form to handle the redirect on submission. It looks something like this:

on_sent_ok: "location = 'http://yourdomain.com/info-contratar/';"

3) Use jQuery either on the page or in an external file and listen mailsent.wpcf7. Documentation.

jQuery( document ).ready( function( $ ) {
    $( '.wpcf7' ).on( 'mailsent.wpcf7', function( e ) {
        window.location.href="http://yourdomain.com/info-contratar/";
    } );
} );

tech