• I use contact form 7 and I save my data in bbdd when the form is fill. For that use:

    add_action( 'wpcf7_before_send_mail', 'save_form' );
    
    function save_form( $wpcf7 ) {
      global $wpdb;
      $submission = WPCF7_Submission::get_instance();
    
      if ( $submission ) {
           $submited = array();
           $submited['title'] = $wpcf7->title();
           $submited['posted_data'] = $submission->get_posted_data();
        }
    
        $data = array(
          'empresa'  => $submited['posted_data']['your-empresa'],
          'nombre'  => $submited['posted_data']['your-nombre'],
          'apellido' => $submited['posted_data']['your-apellidos'],
        );
        $table = $wpdb->prefix . 'users';
        $success = $wpdb->insert( $table, $data );
        // doesn't work
        //wp_redirect( "/info-contratar/" ); exit();
        //wp_redirect(site_url('/info-contratar')); exit();
        //header("Location: /info-contratar/"); exit();
        return $success;
    }

    When functions end. I need use other view: info-contactar, but it never doing redirect. Only I see a Get request with firebug tool.

    How can I do redirect and show my page info-contratar?

    Regards!

Viewing 2 replies - 1 through 2 (of 2 total)
  • HI
    Have you found a solution to the problem?

    have you tried echoing the following html code?
    <META HTTP-EQUIV="refresh" content="0.01;URL=/info-contratar/">
    0.01 is the delay in seconds before refreshing the page. you may adjust this value depending on your needs. it will force a page refresh if supported by the browser.

    Thread Starter dacidcm86

    (@dacidcm86)

    Yeah, I have the same problem and your solution doesn’t work for me.
    Thx!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘I need to do redirect in functions.php’ is closed to new replies.