LearnPress Complete Hooks and Filters Reference

This document provides a comprehensive reference of all hooks and filters available in LearnPress. Use the  category navigation to find specific hooks.

Checkout Hooks

Hook Type Description Parameters File
learn-press/before-checkout-form Action Triggered before the checkout form is displayed None inc/lp-template-hooks.php
learn-press/after-checkout-form Action Triggered after the checkout form is displayed None inc/lp-template-hooks.php
learn_press_review_order_before_cart_contents Action Triggered before cart contents in order review None templates/checkout/review-order.php
learn-press/review-order/before-cart-contents Action Modernized version of the above hook None templates/checkout/review-order.php
learn-press/review-order/cart-item Filter Filters a cart item in order review $cart_item templates/checkout/review-order.php
learn-press/review-order/cart-item-product Filter Filters the product object for a cart item $course, $cart_item templates/checkout/review-order.php
learn_press_review_order_before_cart_item Action Triggered before a cart item in order review $cart_item templates/checkout/review-order.php
learn-press/review-order/before-cart-item Action Modernized version of the above hook $cart_item, $cart_item_key templates/checkout/review-order.php

Course Hooks

Hook Type Description Parameters File
learn-press/before-course-content Action Triggered before the course content is displayed None templates/single-course.php
learn-press/after-course-content Action Triggered after the course content is displayed None templates/single-course.php
learn-press/single-course/modern/info-meta Filter Filters the course meta information in modern layout $data_info_meta, $course, $user inc/TemplateHooks/Course/SingleCourseModernLayout.php
learn-press/single-course/modern/section-right/info-meta Filter Filters the section info meta in modern layout $section_info_meta, $course, $user inc/TemplateHooks/Course/SingleCourseModernLayout.php
learn_press_course_price Filter Filters the course price $price, $course_id inc/lp-template-functions.php
lp/is-learning-course Filter Determines if a user is learning a course $is_learning, $course_id inc/lp-template-functions.php
lp_item_course_class Filter Filters course item CSS classes $classes inc/lp-core-functions.php
learnpress/archive-courses-layouts Filter Filters available course archive layouts $layouts inc/lp-template-functions.php
post_class Filter WordPress filter – modified for course post class $classes, $class, $post_id inc/lp-template-hooks.php

Lesson Hooks

Hook Type Description Parameters File
learn-press/before-content-item-summary/lp_lesson Action Triggered before lesson content summary None inc/lp-template-hooks.php
learn-press/content-item-summary/lp_lesson Action Triggered inside lesson content summary None inc/lp-template-hooks.php
learn-press/after-content-item-summary/lp_lesson Action Triggered after lesson content summary None inc/lp-template-hooks.php

Quiz Hooks

Hook Type Description Parameters File
learn-press/before-content-item-summary/lp_quiz Action Triggered before quiz content summary None inc/lp-template-hooks.php
learn-press/content-item-summary/lp_quiz Action Triggered inside quiz content summary None inc/lp-template-hooks.php
learn-press/after-content-item-summary/lp_quiz Action Triggered after quiz content summary None inc/lp-template-hooks.php
learn-press/max-retry-quiz-allowed Filter Maximum number of retries allowed for a quiz $max, $quiz_id, $course_id inc/lp-core-functions.php
learn-press/after-question-wrap Action Triggered after question wrapper element $question inc/lp-deprecated.php

User Hooks

Hook Type Description Parameters File
learn_press_get_students_list_filter Filter Filters available options for student list filtering $filter inc/lp-deprecated.php

Template Hooks

Hook Type Description Parameters File
learn-press/content-item-summary-class Filter Filters CSS classes for content item summary $classes inc/lp-template-functions.php
body_class Filter WordPress filter – modified for LearnPress pages $classes inc/lp-template-hooks.php
document_title_parts Filter WordPress filter – modified for course title $title_parts inc/lp-template-hooks.php
learn-press/get_template_part Filter Filters template part paths $template, $slug, $name inc/lp-template-functions.php
learn-press/locate-template Filter Filters template location $template, $template_name, $template_path inc/lp-template-functions.php

Widget Hooks

Hook Type Description Parameters File
learn_press_widget_courses_params Filter Filters parameters for courses widget $params Various widget files

Miscellaneous Hooks

Hook Type Description Parameters File
comment_form_logged_in Filter Filters the logged-in user message on comment forms $html_login inc/lp-template-functions.php
comment_form_defaults Filter Filters the default comment form fields $defaults inc/lp-template-functions.php
get_comments_number Filter Filters the comments count for courses $count, $post_id inc/lp-template-functions.php
wp_enqueue_scripts Action WordPress action – used to load comment scripts None inc/lp-template-functions.php

Deprecated Hooks

The following hooks are deprecated and should not be used in new code. They are maintained for backward compatibility but may be removed in future versions.

Hook Type Description Replacement Deprecated Since
learn-press/content-item-summary-class Filter Filters CSS classes for content item summary None specified 4.2.3.1
learn_press_get_students_list_filter Filter Filters available options for student list filtering None specified 4.2.7.4
learn_press_body_classes Filter Filters body classes for LearnPress pages None specified 4.2.3