Support

Account

Home Forums General Issues update_field and switch_to_blog Reply To: update_field and switch_to_blog

  • Just an update – I tried to do this without any Gravity Forms code at all to see if that might be the problem – I just created a simple form in one page template and submitted it to another page, with a template to process the form. Still no dice. I’m thinking this is a conflict with switch_to_blog() and update_field()

    $channel_blog = $_POST['channel_blog'];
    $event_id = $_POST['event_id'];
    $win_loss = $_POST['win_loss'];
    $our_score = $_POST['our_score'];
    $opponent_score = $_POST['opponent_score'];
    	  	
    //Switch to the school's blog 
    switch_to_blog($channel_blog);
    		
    update_field('field_5215741f54e1f', $win_loss, $event_id ); // Win/Loss
    update_field('field_5215744854e20', $our_score, $event_id ); // Our Score
    update_field('field_5215746754e21', $opponent_score, $event_id ); // Opponent Score
    		
    // Restore Original Post Data
    restore_current_blog();