This shortcode allows group members to leave a group. The shortcode requires the group attribute to provide the name or ID of the desired group. It renders a button that the user can click to leave the group. For example, to let members of the Test group leave, provided that the group exists:
[groups_leave group="Test"]
The shortcode recognizes the following attributes:
group: (required) The group ID or name.class: (optional) Additional CSS class(es) to apply to the container that holds the HTML elements rendered. The container has the classgroups-leaveby default.display_message: (optional) Whether to show a confirmation after leaving the group. Accepted values are:trueandfalse. The default value istrue.submit_text: (optional) Specify this to change the button text template. If the group name should be displayed, the template text must contain the placeholder%swhere the group name should appear. The default button text template is"Leave the %s group".submit_class: (optional) Additional CSS class(es) to apply to the submit HTML input element. The element has the class groups-join-submit by default. For example, addingwp-element-buttonwould style this like other buttons (depending on your theme).
With the latest version of Groups, the shortcode will render if the author of the page has the permission to Restrict Access. This permission can be granted to certain roles or by assigning the groups_restrict_access capability to a group to allow its members to use it. Only users you trust to allow others to join as group members should be granted this permission.
Example
To let users leave the Test group, you could simply place this on a page:
Click the button to leave: [groups_leave group="Test"]
This will render a button that members of the group can click to leave the group:

If we provide additional CSS classes like wp-element-button, the appearance can be adjusted to match that of the theme if it supports it.
Click the button to leave: [groups_leave group="Test" submit_class="wp-element-button"]
Which will render like this with the Twenty Twenty-Five theme:

