For developers

Updated

This page is a short summary for people who build on Public LMS. The full developer reference, with every hook, REST route and command, ships with the plugin’s source.

Blocks and shortcodes

The plugin’s front-end screens are blocks. The blocks are: course-grid, course-filters, course-hero, course-outcomes, course-faq, enroll-button, course-curriculum, course-progress, course-meta, course-instructors, course-reviews, student-dashboard, instructor-dashboard, certificate-verify, login, profile and checkout.

Every block has a shortcode in the form [publms_{block}]. These aliases also work: [publms_dashboard], [publms_courses], [publms_course_search], [publms_verify_certificate] and [publms_instructor_dashboard].

Elementor, Bricks and Divi have widgets that wrap the same blocks.

Template overrides

The plugin ships its front-end templates in its templates/ folder. To change one, copy the file to a public-learning-management-system/ folder inside your theme, with the same relative path.

Each template has a version, raised whenever the plugin changes it. LMS → Status lists your theme’s copies that are older than the plugin’s under Template overrides. See The Status screen.

WP-CLI commands

Every command is under wp publms. Add --help to any of them for the full synopsis.

CommandWhat it does
wp publms course listList courses.
wp publms course createCreate a course.
wp publms course curriculumShow a course’s curriculum.
wp publms course add-sectionAdd a section.
wp publms course add-itemAdd a lesson, quiz or assignment to a section.
wp publms course duplicateDuplicate a course.
wp publms course deleteTrash a course and its curriculum.
wp publms course export <id> [--file=<path>]Export a course as JSON.
wp publms course import <file>Import a course from JSON (as a draft).
wp publms question listList a quiz’s questions.
wp publms question addAdd a question from JSON.
wp publms question deleteDelete a question.
wp publms question typesThe question types this site can use.
wp publms enrollment listList enrollments.
wp publms enrollment addEnroll a user in a course.
wp publms enrollment removeCancel a user’s enrollment (their progress stays, so re-enrolling resumes it).
wp publms enrollment progressShow a user’s progress in a course.
wp publms enrollment resetStart a course over: clear a user’s progress and reactivate the enrollment.
wp publms pages listList the pages and their state.
wp publms pages createCreate the missing pages and the default course levels.
wp publms pages assignPoint a page key at an existing page.
wp publms settings listList every setting with its value.
wp publms settings getGet one setting.
wp publms settings setSet one setting.
wp publms settings resetRestore every default.
wp publms settings exportExport the settings as JSON (secrets left out).
wp publms settings importImport settings from a JSON file produced by export.
wp publms statusReport the plugin’s edition, database, roles, pages, scheduling, stores and feature availability.
wp publms migrate sourcesList the plugins this site holds courses for.
wp publms migrate runBring everything over from one plugin. Safe to run again: what was brought over before is skipped, and new students and progress are added.

To preview a move from another LMS, add --dry-run to wp publms migrate run. See Moving from another LMS.

REST API and Abilities API

The plugin has a REST API; its routes are under public-learning-management-system/v1. It also registers abilities with WordPress’s Abilities API.

Hooks

The plugin has actions and filters for extending it, for example to add a payment gateway, an email, a status check or a dashboard section. The hook reference in the plugin’s source lists each one with its parameters.

Browser events

The plugin fires a publms:enrolled browser event after a free enrollment and a publms:purchase event when the receipt of a paid order is shown, and pushes publms_enrolled and publms_purchase to window.dataLayer when the page has one. Developers can change or remove the events with the publms_browser_events filter. See Analytics events.

Was this page helpful?