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();
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc
— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.