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
| Ability | learndash/delete-lesson |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Lessons, Topics & Quizzes |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Destructive — requires confirm_title. Nested topics and quizzes are not deleted. |
| Repeatable | Not idempotent — each call changes the row set, so re-running is not a no-op |
| Ships in | AcrossAI 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
| Name | Type | Required | What it is |
|---|---|---|---|
lesson_id | integer | Yes | The lesson. |
confirm_title | string | Yes | Must exactly match the current title on the live record. |
force | boolean | No | True deletes permanently; false trashes. |
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 |
|---|---|---|
lesson_id | integer | The lesson. |
affected_courses | array | Every course outline it was removed from. |
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:
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
- LearnDash Detach Step — remove it from one course only
- LearnDash Get Course Structure — see what is nested under it
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category