learndash/manage-group-courses adds or removes the courses a group grants.
The reach is the thing to hold in mind: this is a per-member operation wearing the clothes of a per-group one.
At a glance
| Ability | learndash/manage-group-courses |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Groups |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Writes data |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Pro 0.9.16 and later |
How it works
Adding a course grants it to every member of the group at once. Removing one revokes it from every member at once — unless they hold that course directly as well, in which case their own enrolment survives.
So a group with four hundred members is four hundred grants or revocations from a single-line call, and the response reports how many members were affected.
This is incremental. Pass add and remove as arrays; anything you do not mention is left alone. That makes a single change a single call, and it means a caller cannot wipe a list by sending a short one.
Learner progress is never deleted by any of this. A course revoked and later re-granted returns the learner to exactly where they were, which makes membership changes safe in the way that learndash/reset-user-progress is not.
Read learndash/list-group-members first when the member count matters, which is most of the time.
Idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
group_id | integer | Yes | The group. |
add | array | No | Course post IDs to grant. |
remove | array | No | Course post IDs to stop granting. |
What comes back
| Name | Type | What it is |
|---|---|---|
courses | array | The courses the group grants afterwards. |
members_affected | integer | How many members gained or lost access. |
success | boolean | Whether the call completed. |
message | string | A one-line summary of what happened, suitable for showing a human. |
error_code | string | Present only on failure — a stable machine-readable reason, such as a missing field, a wrong field type or an unmet confirmation. |
Example
Ask your assistant:
Add the advanced course to this cohort.
It resolves to one call:
{
"ability": "learndash/manage-group-courses",
"parameters": {
"group_id": 700,
"add": [418]
}
}Worth knowing
- One call grants or revokes for every member.
- A directly held course survives a group revocation.
- Incremental — unmentioned courses stay assigned.
- Progress is never deleted.
Related abilities
- LearnDash List Group Members — how many this affects
- LearnDash Get Group — what it currently grants
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category