Get Lesson Object for a Topic in LearnDash

While customizing LearnDash I came across an issue in the topic.php file where the $lesson_post variable was returning null even when there was a parent lesson for the topic.

So, after digging around at the LearnDash source code a bit I came up with this simple solution to grab the lesson whenever I needed using the topic post which is accessible via $post.

Not sure if others will find this helpful, but there are not a ton of extensive docs or articles on developing for LearnDash so wanted to share 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s