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

Start free trial

LearnDash Delete Course

learndash/delete-course permanently deletes or trashes a course.

What it leaves behind is the part worth understanding.

Before you run it

Deleting a course does not delete its lessons, topics or quizzes. They survive as orphans: still in the library, attached to nothing, unreachable by learners. Enrolment and progress records are left behind too, pointing at a course that no longer exists. A course with steps therefore requires confirm_orphan_steps=true as well as the title. Prefer force=false, which trashes the post and is reversible. Permanent deletion is the option that needs a reason.

At a glance

Abilitylearndash/delete-course
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Courses
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyDestructive — requires confirm_title, and confirm_orphan_steps when the course still has steps.
RepeatableNot idempotent — each call changes the row set, so re-running is not a no-op
Ships inAcrossAI Pro 0.9.16 and later

How it works

LearnDash does not cascade deletions down a course outline. Steps nested under what you delete survive as orphans — still in the library, attached to nothing, invisible to learners and easy to lose track of.

So a course with forty lessons deleted outright leaves forty lessons in the library with no course. They are not broken, exactly — they can be attached elsewhere — but nothing points at them and nobody will find them by accident.

That is why the extra confirmation exists: a course ID says nothing about how much content is about to become unreachable.

Enrolment and progress records also survive, pointing at a course that no longer exists. They do no harm and they inflate reporting, and there is no cleanup for them here.

Prefer force=false, which trashes the post and is reversible. Permanent deletion is the option that needs a reason.

A trashed course stops being reachable by learners while everything remains restorable, which covers almost every reason somebody wants a course gone.

Not idempotent.

Input

NameTypeRequiredWhat it is
course_idintegerYesThe course.
confirm_titlestringYesMust exactly match the current title on the live record.
confirm_orphan_stepsbooleanWhen the course has stepsAcknowledges that lessons, topics and quizzes are left orphaned.
forcebooleanNoTrue deletes permanently; false trashes and is reversible.
confirmbooleanYes — must be trueThe irreversibility gate. Without it the call is refused before anything is touched.

What comes back

NameTypeWhat it is
course_idintegerThe course.
orphaned_stepsintegerHow many steps were left unattached.
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:

Delete the retired onboarding course.

It resolves to one call:

{
  "ability": "learndash/delete-course",
  "parameters": {
    "course_id": 412,
    "confirm_title": "Onboarding Essentials",
    "confirm_orphan_steps": true
  }
}

Worth knowing

  • Lessons, topics and quizzes survive as orphans.
  • Enrolment and progress records survive too, pointing at nothing.
  • Trashing removes learner access and stays reversible.
  • Not idempotent.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading