What are LearnDash Hooks (actions and filters)?

One of the most important reasons to use LearnDash is the ability to customize it to your requirements. This is simply not possible with an online course platform like Teachable.

The WordPress ecosystem has a lot of plugins, but you don’t always need to add plugins to get more out of your LearnDash installation (although you need to hire a PHP developer).

One way to get more out of your LearnDash plugin is to use the “hooks” it provides.

What are hooks?

Hooks are custom code snippets you can add to LearnDash to extend its functionality to do something it doesn’t provide out of the box.

There are two kinds of hooks – actions and filters. Actions add functionality and filters modify values.

For example, I used a filter called “learndash_payment_closed_button” which usually returns the URL (or any other text you want to display) on the button for a closed course.

So I modified the default value to exhibit this behavior:

  • if the user is not logged in, ask them to log in first
  • if they are logged in, provide a link to the payment URL so they can purchase my course

By using this filter, I was able to solve a fairly thorny problem of integrating LemonSqueezy with my LearnDash courses, because I can now ensure a user is logged in before purchase, which in turn will ensure they can get automatic access to the course as soon as they complete the purchase.

About this website

BotFlo1 was created by Aravind Mohanoor as a website which provided training and tools for non-programmers who were2 building Dialogflow chatbots.

This website has now expanded into other topics in Natural Language Processing, including the recent Large Language Models (GPT etc.) with a special focus on helping non-programmers identify and use the right tool for their specific NLP task. 

For example, when not to use GPT

1 BotFlo was previously called MiningBusinessData. That is why you see that name in many videos

2 And still are building Dialogflow chatbots. Dialogflow ES first evolved into Dialogflow CX, and Dialogflow CX itself evolved to add Generative AI features in mid-2023