Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
itthinx Groups - Auto group for media files
add_action('add_attachment', 'my_add_attachment');
function my_add_attachment ( $post_id ) {
$group_ids[] = 2;
Groups_Post_Access::update( array( 'post_id' => $post_id, 'groups_read' => $group_ids ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.