Development

How to Build a Tutor LMS Add-on Plugin (Boilerplate)

A clean boilerplate for your own Tutor LMS extension: plugin header, dependency check, loading after Tutor LMS, hooks, templates, settings and an uninstall routine.

Checked against the plugin source: Tutor LMS 4.1.3, Tutor LMS Pro 4.1.3

How to Build a Tutor LMS Add-on Plugin (Boilerplate)

Custom Tutor LMS features belong in their own plugin: theme changes cannot wipe them, they can be switched off for testing, and they survive Tutor LMS updates. This boilerplate is what we start from, checked against Tutor LMS 4.1.3.

Folder structure

tle-tutor-extension/
  tle-tutor-extension.php   Main file: header, checks, bootstrap
  includes/
    class-plugin.php        Registers hooks
  templates/
    dashboard/resources.php Optional dashboard page
  uninstall.php             Removes your options on delete

The main file

<?php
/**
 * Plugin Name: TLE Tutor Extension
 * Description: Custom features for our Tutor LMS site.
 * Version: 1.0.0
 * Requires PHP: 7.4
 * Requires Plugins: tutor
 */

defined( 'ABSPATH' ) || exit;

define( 'TLE_EXT_FILE', __FILE__ );
define( 'TLE_EXT_DIR', plugin_dir_path( __FILE__ ) );

add_action( 'plugins_loaded', 'tle_ext_boot', 20 );

function tle_ext_boot() {
	if ( ! function_exists( 'tutor_utils' ) ) {
		add_action(
			'admin_notices',
			function () {
				echo '<div class="notice notice-error"><p>TLE Tutor Extension needs Tutor LMS.</p></div>';
			}
		);
		return;
	}

	require_once TLE_EXT_DIR . 'includes/class-plugin.php';
	TLE_Ext_Plugin::init();
}

The Requires Plugins header (WordPress 6.5+) makes WordPress require Tutor LMS (slug tutor) before activation. The function_exists() check still protects older setups and the moment Tutor LMS is deactivated. Loading on plugins_loaded at priority 20 ensures Tutor LMS has loaded first.

Registering hooks

final class TLE_Ext_Plugin {
	public static function init() {
		add_action( 'tutor_after_enrolled', array( __CLASS__, 'on_enrolled' ), 10, 3 );
		add_action( 'tutor_course_complete_after', array( __CLASS__, 'on_completed' ), 10, 2 );
		add_filter( 'tutor_get_template_path', array( __CLASS__, 'template_path' ), 10, 2 );
	}

	public static function on_enrolled( $course_id, $student_id, $enrollment_id ) {
		// Your logic.
	}

	public static function on_completed( $course_id, $user_id ) {
		// Your logic.
	}

	public static function template_path( $location, $template ) {
		$file = TLE_EXT_DIR . 'templates/' . $template . '.php';
		return file_exists( $file ) ? $file : $location;
	}
}

Hook choices are covered in the hooks reference.

Checking for Pro features

If your add-on uses a Pro feature, check for it before relying on it:

$has_pro = function_exists( 'tutor' ) && tutor()->has_pro;
$has_certificates = $has_pro && tutor_utils()->is_addon_enabled( 'tutor-pro/addons/tutor-certificate/tutor-certificate.php' );

Settings

For a few options, a small page under the Tutor LMS menu with the WordPress Settings API is enough. Store options under your own prefix, never inside Tutor LMS's settings array, so a Tutor LMS settings reset does not touch yours.

Uninstall

<?php
// uninstall.php
defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
delete_option( 'tle_ext_settings' );

Remove only your own data. Never delete Tutor LMS tables or meta.

Quality checklist

  • Prefix every function, class, option and meta key.
  • Escape output, sanitize input, check capabilities and nonces on every form or AJAX action.
  • Keep remote calls out of page loads, or queue them.
  • Test with Tutor LMS deactivated: your plugin must not fatal.
  • Re-test after each Tutor LMS release.

See also making customizations update-safe. Want it built for you? Our plugin development team builds Tutor LMS add-ons.

Save this practical guide

Add us as a preferred Google source, or ask an AI assistant to summarize this page and link back to the original guide when it is useful.

Vishavjeet
· Enterprise LMS Architect | WordPress & LMS Expert | WooCommerce | AI Automation

I’m Vishavjeet Choubey, an Enterprise LMS Architect with 10+ years of experience helping businesses, coaches, universities, and online academies build and scale powerful digital learning platforms. I specialize in enterprise LMS architecture, WordPress, WooCommerce, LifterLMS, LearnDash, Moodle, custom plugin development, and AI-driven automation. I build scalable LMS platforms, high-converting eCommerce solutions, and custom WordPress applications designed to improve user experiences, streamline operations, and drive measurable business growth. My approach combines deep WordPress and LMS engineering expertise with modern AI automation to reduce manual work, improve efficiency, and help organizations launch, scale, and grow faster.

Keep reading

Need a custom Tutor LMS solution?

Tell us what you are building or what is broken. A Tutor LMS developer reads every inquiry and replies with next steps and a free estimate.

Get a free Tutor LMS consultation

Tell us what you are building or fixing. A Tutor LMS developer replies with honest advice and next steps.

  • No obligation
  • Tutor LMS and Pro specialists
  • Your details stay private

This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.