Support

Account

Home Forums ACF PRO update_post functionality

Solving

update_post functionality

  • add_filter('acf/save_post' , 'acf_save_post_type_filter',  20 );
    
    function acf_save_post_type_filter($post_id) {
    
    // We have been called from the action_log post type
    
         if (get_post_type($post_id) == 'action_log'){
    
    // What is the ID of the associated post_type?
    
              $associated_id = get_field('associated_id', $post_id);
    
    // Update the field in the associated post type
              update_field('action_completed', 'Yes', $associated_id);
    
         }
    
    }
    
    When I try and use this code it returns false and does not update the associated field.
    
    Thoughts?
  • Thanks John. Looks like the forum is working. Did you remove the post?

  • More info …

    The field exists.
    If you call the function from the post type the field exists in you can update the field.
    I can use get_posts to retrieve data from the second post type I am trying to save to.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘update_post functionality’ is closed to new replies.