Support

Account

Forum Replies Created

  • Again thank you John. This is a side project and I can’t dedicate a lot of time to it now, but soon I’m going to break down the entire code and start over.

    You were right that even a greater priority causes the same issue. I’ve tried using something like the below too:

    if(isset($_POST['acf']['field_6001b1b8a2cff']) ) {
          $new_title = $_POST['acf']['field_6001b1b8a2cff'];
        }

    But even then it works only on the backend since the front end still thinks there is no “old” value. I’ll figure this out eventually and post my results.

  • Hi John,

    I appreciate your quick response. I did try ‘acf/save_post’; however this gives me an ArgumentCountError, the ACF documentation shows that acf/save_post does not work with the $post and $update parameters.

    I’ve tried removing them but then I can’t update the post on the frontend. I’m close and will keep experimenting, but if you have any other suggestions, I’m all ears.

  • Finally figured it out and your explanation above was the answer. Thank you again.

  • Thank you John. I’m still struggling to get it work, but will fiddle around and when I figure it out get back to this thread.

  • I know this is an old post and was solved, but wanted to ask, what if the Events fields were in repeater fields? I tried to modify as below, but not getting the right results.

    add_action('acf/save_post', 'save_event_update_address', 20);
    function save_event_update_address($post_id) {
      if (get_post_type($post_id) != 'events') {
        // not and event post, bail
        return;
      }
      // get location post ID
      // you said it's a relationship field, a relationship field will turn an array of posts
      // I am setting the 3rd parameter because we only need the IDs
      $related_places = get_sub_field('relationship_field_name');
      // also the 
      if ($related_places) {
        $place_id = $related_places[0];
        $address = get_field('address_field_on_place_name', $place_id);
        update_sub_field('address_field_on_event_repeater_name, $address, $post_id);
      }
    }
Viewing 5 posts - 1 through 5 (of 5 total)