Support

Account

Home Forums General Issues acf/pre_save_post with a Post Object Reply To: acf/pre_save_post with a Post Object

  • You need to know the acf key of that other field and you can set it. Just like your example, but use the field key where you have “s”

    
    $_POST['acf']['s'] = {value to set};
    

    as I noted, the acf post object field will have a string value of the post ID. If you want to populate the other field with the ID then you’d just copy that value over. If you want to use other information about the post then you’ll need to get the post and get that other information as I explained above. In all cases, you need to provide a value that is in the same format that ACF is expecting to be submitted by the field you’re trying to auto populate.