learndash/unenroll-user revokes a learner’s access to a course, or removes them from a group.
Their progress and quiz history are not deleted.
Before you run it
Removing somebody from a group revokes every course that group carried, and the response lists them — which is a much wider revocation than the single course the request might look like. confirm_user_email must match the learner exactly, so access is never removed from a misidentified person.
At a glance
| Ability | learndash/unenroll-user |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Enrolment & Access |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Destructive in that it takes access away. Requires confirm_user_email matching the learner. |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Pro 0.9.16 and later |
How it works
That is the important reassurance. Unenrolling takes access away and leaves the record — so re-enrolling restores their position exactly, with every completed step and every quiz attempt intact.
If erasing the record is what was actually wanted, learndash/reset-user-progress is that operation, and it is a different and harder one.
The group case is the wide one. Removing somebody from a group revokes every course the group carried — unless they also hold a course directly, in which case that one survives.
The response lists what was revoked, which is the only way to see the scope after the fact. learndash/get-access-info shows it beforehand.
The email confirmation exists because access is being taken from a named person, and an ID is easy to mistake in a way an email address is not.
Idempotent.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
learner | string | integer | Yes | User ID, login or email. |
product_id | integer | Yes | A course or a group. |
confirm_user_email | string | Yes | Must exactly match the target learner’s email address. |
confirm | boolean | Yes — must be true | The irreversibility gate. Without it the call is refused before anything is touched. |
What comes back
| Name | Type | What it is |
|---|---|---|
courses_revoked | array | Every course the learner lost. |
changed | boolean | False when they did not have it. |
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:
Remove this learner from the course.
It resolves to one call:
{
"ability": "learndash/unenroll-user",
"parameters": {
"learner": "sam@example.com",
"product_id": 412,
"confirm_user_email": "sam@example.com"
}
}Worth knowing
- Progress and quiz history survive. Re-enrolling restores their position.
- Removing from a group revokes every course it carried.
- A directly held course survives a group removal.
- Erasing the record is a different ability.
Related abilities
- LearnDash Get Access Info — see the scope first
- LearnDash Reset User Progress — erase the record instead
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category