30 days free. No credit card. Full access from the moment you connect your site.

Start free trial

LearnDash Unenroll User

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

Abilitylearndash/unenroll-user
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Enrolment & Access
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyDestructive in that it takes access away. Requires confirm_user_email matching the learner.
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
learnerstring | integerYesUser ID, login or email.
product_idintegerYesA course or a group.
confirm_user_emailstringYesMust exactly match the target learner’s email address.
confirmbooleanYes — must be trueThe irreversibility gate. Without it the call is refused before anything is touched.

What comes back

NameTypeWhat it is
courses_revokedarrayEvery course the learner lost.
changedbooleanFalse when they did not have it.
successbooleanWhether the call completed.
messagestringA one-line summary of what happened, suitable for showing a human.
error_codestringPresent 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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading