learndash/get-quiz-statistics returns aggregate performance for one quiz across everyone who has taken it, as recorded in LearnDash’s statistics tables.
It requires statistics to be enabled in the quiz’s settings.
At a glance
| Ability | learndash/get-quiz-statistics |
| Toolset | LearnDash — toolset/learndash |
| Group | LearnDash › Reporting |
| Requires | AcrossAI Pro, plus LearnDash LMS active on the site |
| Capability | manage_options |
| Safety | Read-only — changes nothing |
| Repeatable | Idempotent — running it twice leaves the same result |
| Ships in | AcrossAI Pro 0.9.16 and later |
How it works
That is a per-quiz setting and it is off by default on some configurations. A quiz with hundreds of attempts and statistics switched off has no statistics records at all — the attempts happened and nothing recorded the detail.
So an empty result is reported distinctly from “nobody took it”, because the two look identical and mean opposite things.
Turning statistics on does not backfill. Attempts made while it was off stay unrecorded, which means enabling it partway through a cohort produces figures covering only part of them.
Goes through LearnDash’s own REST controller so the figures match its reporting screen, and therefore needs the LearnDash REST API enabled.
For one learner’s attempts, learndash/list-quiz-attempts reads the per-learner records, which exist independently of the statistics setting.
Input
| Name | Type | Required | What it is |
|---|---|---|---|
quiz_id | integer | Yes | The quiz. |
What comes back
| Name | Type | What it is |
|---|---|---|
statistics | object | Aggregate performance across all takers. |
statistics_enabled | boolean | False means the empty result is a setting, not an absence of attempts. |
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:
How is everyone doing on this quiz?
It resolves to one call:
{
"ability": "learndash/get-quiz-statistics",
"parameters": {
"quiz_id": 640
}
}Worth knowing
- Statistics are a per-quiz setting, off by default on some configurations.
- Empty because switched off is reported distinctly from empty because untaken.
- Enabling it does not backfill earlier attempts.
- Requires LearnDash’s REST API.
Related abilities
- LearnDash List Quiz Attempts — per-learner records, always kept
- LearnDash Manage Quiz — enable statistics
Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager
Browse the rest: Every ability, by category