How do I add custom code to LifterLMS or LifterLMS LaunchPad?


# Top

From time to time you may wish to add custom code, like actions or filters, to your site to modify various parts of LifterLMS, LifterLMS LaunchPad, or other LifterLMS plugins. We may even direct you to do this during support requests and you might find example code in our documentation. You may also wish to override LifterLMS templates.

Download LifterLMS Customizations

# Top

We’ve created a simple plugin for you to download and install, for free, to help speed up the process of adding actions, filters, and template overrides to your site.

To get started:

  1. Download the LifterLMS Customizations plugin ( file).
  2. Go to Plugins > Add New.
  3. Click the Uploads tab, and upload the file.
  4. Select Activate.

Once installed you can use either FTP or the WordPress editor to add custom PHP to the plugin.

Adding Custom PHP

# Top

Any custom PHP code can be added to the file “lifterlms-customizations.php” between the two comments “Add custom functions below this comment” and “Add custom functions above this comment”

If you are copying code from our documentation or elsewhere, ensure you don’t add opening (<?php) or closing (?>) PHP tags as they will cause errors! These have already been added for you.


Template Overrides

# Top

If you wish to add template overrides according to our override documentation you can copy the LifterLMS templates to the “templates” directory in the LifterLMS Customizations plugin. After doing so, locate the function in “lifterlms-customizations.php” llms_customizations_overrides_directory() and uncomment the commented out add_filter() line directly below this function.

This filter is commented out by default to prevent unnecessary override checks to an empty directory.

Removing Actions

# Top

If you are removing actions added by LifterLMS, LifterLMS extensions, or LifterLMS LaunchPad, you’ll want to ensure that you wait until the actions have been added to remove them. In most cases, adding your custom code into another function called after plugins are initialized will do the job.

Last Updated on
Was this article helpful?