Is there a way to automatically/programmatically restrict the visibility of a post, while creating this post (with a Groups group that already exists)?
First challenge: The post is created automatically from a user-submitted Gravity Forms form, at unpredictable times, so we can’t wait until after it shows up to go into the admin and manually restrict visibility.
Second challenge: Although the Groups group used for this visibility restriction is always expected to exist, there are actually quite a few groups that could be used. Only one needs to be applied in this visibility restriction, but we cannot predict in advance which one it will be.