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

Start free trial

LearnDash Delete Lesson

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

It affects every course the lesson was in, not just one.

Before you run it

Topics and quizzes nested under the lesson are not deleted — they survive as orphans in the library. The lesson is removed from every course outline that contained it, not only the one you were thinking of, and the response lists the affected course IDs. To remove a lesson from one course without deleting it, learndash/detach-step is the ability. Prefer force=false, which trashes the post and is reversible. Permanent deletion is the option that needs a reason.

At a glance

Abilitylearndash/delete-lesson
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Lessons, Topics & Quizzes
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyDestructive — requires confirm_title. Nested topics and quizzes are not deleted.
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

A lesson can belong to several courses. Deleting it removes it from all of them, and the response lists which — which is usually the first anybody learns that the lesson was shared.

That is the case learndash/detach-step exists for: removing a lesson from one course leaves it in the others and in the library.

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 the topics and quizzes under the lesson stay in the library with nothing above them. They can be re-attached elsewhere, and until somebody does they are invisible.

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

Not idempotent.

Input

NameTypeRequiredWhat it is
lesson_idintegerYesThe lesson.
confirm_titlestringYesMust exactly match the current title on the live record.
forcebooleanNoTrue deletes permanently; false trashes.
confirmbooleanYes — must be trueThe irreversibility gate. Without it the call is refused before anything is touched.

What comes back

NameTypeWhat it is
lesson_idintegerThe lesson.
affected_coursesarrayEvery course outline it was removed from.
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 that old lesson.

It resolves to one call:

{
  "ability": "learndash/delete-lesson",
  "parameters": {
    "lesson_id": 520,
    "confirm_title": "Setting up your workspace"
  }
}

Worth knowing

  • Removed from every course it was in, not just one.
  • Nested topics and quizzes survive unattached.
  • Detaching is the single-course alternative.
  • Trashing is reversible.

Related abilities


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading