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

Start free trial

LearnDash Get Quiz Statistics

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

Abilitylearndash/get-quiz-statistics
ToolsetLearnDash — toolset/learndash
GroupLearnDash › Reporting
RequiresAcrossAI Pro, plus LearnDash LMS active on the site
Capabilitymanage_options
SafetyRead-only — changes nothing
RepeatableIdempotent — running it twice leaves the same result
Ships inAcrossAI 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

NameTypeRequiredWhat it is
quiz_idintegerYesThe quiz.

What comes back

NameTypeWhat it is
statisticsobjectAggregate performance across all takers.
statistics_enabledbooleanFalse means the empty result is a setting, not an absence of attempts.
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:

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


Get the plugins:
AcrossAI Abilities Manager · AcrossAI MCP Manager

Browse the rest: Every ability, by category


Keep reading