Support » Plugin: Groups » Created Post should automatically assigned to registered group

  • masjmh


    How can I automatically assign the Post to registered group?
    I mean If the Post is created (through Registered user or through Form) than it should be assigned for registered user automatically?
    Groups – Read and the option should be Registered.
    At present I have to select Post and than assigned to registered.

    Many Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Kento


    Hey Amir,

    Groups won’t do this automatically for you, but if you’re interested in a programmatic solution, you could craft a simple one based on the save_post action which would do

            'post_id' => $post_id,
            'group_id' => $group_id

    to assign the group restriction to the saved post. You’ll receive the $post_id obviously from the action and you can set the $group_id using Groups_Group::read_by_name( 'Registered' );

    Does that help?

    • This reply was modified 3 years ago by Kento.

    Hi Kento,
    I have to restrict the visibility of a Post only to members of the Group of the current user. So how could I get the Group ID(s) of the user creating the post? (the currently logged-in user)

    Thank you

    I found the answer here:, see
    “Get all groups the current user belongs to”

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Created Post should automatically assigned to registered group’ is closed to new replies.