Filter Hooks

Here you’ll find a list of the Filter Hooks available for Tutor LMS.

Admin

File Location: /tutor/classes/Admin.php

echo apply_filters('tutor/options/generated-html', $tutor_option->generate());
include apply_filters('tutor_admin_tools_page', tutor()->path."views/pages/{$tutor_admin_tools_page}.php", $tutor_admin_tools_page);
apply_filters(
    'tutor_tool_pages', array(
				'tutor_pages' => array(
				    'title' => __('Tutor Pages', 'tutor') ),
				'status' => __('Status', 'tutor'),
			));
if ( apply_filters( 'tutor_display_admin_footer_text', (tutor_utils()->array_get('parent_base', $current_screen) === 'tutor' ) ) ) {

Ajax.php

If you want to add a question to Tutor LMS system from your custom plugin or functionality, then you can use the tutor_add_question_data filter. Here is a sample snippet to help you understand the available parameters-

apply_filters('tutor_add_question_data', array(
			'comment_post_ID'   => $course_id,
			'comment_author'    => $user->user_login,
			'comment_date'      => $date,
			'comment_date_gmt'  => get_gmt_from_date($date),
			'comment_content'   => $question,
			'comment_approved'  => 'waiting_for_answer',
			'comment_agent'     => 'TutorLMSPlugin',
			'comment_type'      => 'tutor_q_and_a',
			'user_id'           => $user_id,
		));

Similarly, the filter tutor_add_answer_data filter lets you add an answer to the Q&A system of Tutor LMS.

apply_filters('tutor_add_answer_data', array(
			'comment_post_ID'   => $question->comment_post_ID,
			'comment_author'    => $user->user_login,
			'comment_date'      => $date,
			'comment_date_gmt'  => get_gmt_from_date($date),
			'comment_content'   => $answer,
			'comment_approved'  => 'approved',
			'comment_agent'     => 'TutorLMSPlugin',
			'comment_type'      => 'tutor_q_and_a',
			'comment_parent'    => $question_id,
			'user_id'           => $user_id,
		));

If you want to customize the validation messages on the login screen, you can use the tutor_process_login_errors filter like below-

apply_filters( 'tutor_process_login_errors', $validation_error, $creds['user_login'], $creds['user_password'] );
apply_filters( 'tutor_login_credentials', $creds ), is_ssl() );
apply_filters('tutor_login_redirect_url', $redirect_to)
apply_filters( 'login_errors', $e->getMessage()) );

Assets.php

apply_filters('tutor_localize_data', $localize_data);

Course.php

apply_filters('tutor_instructor_query_when_exists', " AND ID <1 ");
apply_filters('tutor_course_instructors_html', $instructor_output, $instructors);
apply_filters('should_remove_price_if_enrolled', true);

Course_Settings_Tabs.php

apply_filters( 'use_block_editor_for_post_type', true, 'courses' );
apply_filters('tutor_course_settings_tabs', $args);

Course_Widget.php

apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];

FormHandler.php

apply_filters( 'tutor_get_username_from_email', true ) ) {
$allow = apply_filters( 'allow_password_reset', true, $user_data->ID );

		if ( ! $allow ) {
			tutor_flash_set('danger', __( 'Password reset is not allowed for this user', 'tutor' ) );
			return false;
		} elseif ( is_wp_error( $allow ) ) {
			tutor_flash_set('danger', $allow->get_error_message() );
			return false;
		}
$user = wp_signon( apply_filters( 'tutor_login_credentials', $creds ), is_ssl() );
apply_filters('tutor_email_from_address', get_tutor_option('email_from_address'));
apply_filters('tutor_email_from_name', get_tutor_option('email_from_name'));

Instructor.php

apply_filters('tutor_instructor_registration_required_fields', array(
		'first_name'                => __('First name field is required', 'tutor'),
		'last_name'                 => __('Last name field is required', 'tutor'),
		'email'                     => __('E-Mail field is required', 'tutor'),
		'user_login'                => __('User Name field is required', 'tutor'),
		'password'                  => __('Password field is required', 'tutor'),
		'password_confirmation'     => __('Password Confirmation field is required', 'tutor'),
		));
update_user_meta($user_id, '_tutor_instructor_status', apply_filters('tutor_initial_instructor_status', 'pending'));
apply_filters('add_new_instructor_data', array(
			'user_login'    =>  $user_login,
			'user_email'    =>  $email,
			'first_name'    =>  $first_name,
			'last_name'     =>  $last_name,
			'role'          =>  tutor()->instructor_role,
			'user_pass'     =>  $password,
		));

Options.php

This file is used to control the settings of Tutor LMS. The settings can be viewed from WP Admin > Tutor LMS > Settings. If you want to change the settings from your external plugin or custom code, you may follow this section.

If you want to integrate a new plugin to sell courses and include the selection option in Tutor LMS > Settings > Monetization, then you can use the tutor_monetization_options filter.

'options'   => apply_filters('tutor_monetization_options', array(
								//add new monetization options here
									'free'          =>  __('Disable Monetization', 'tutor'),
								)),
  • return apply_filters($key, $option[$key]);
  • return apply_filters($key, $new_option);
  • $option = apply_filters(‘tutor_option_input’, $option);
  • ‘options’   => apply_filters(‘tutor_monetization_options’, array(
  • $attrs = apply_filters(‘tutor/options/attr’, $attr);
  • $extends = apply_filters(‘tutor/options/extend/attr’, array());

Post_types.php

$courses_base_slug = apply_filters('tutor_courses_base_slug', $course_post_type);
$lesson_base_slug = apply_filters('tutor_lesson_base_slug', $lesson_post_type);

Q_and_A.php

$data = apply_filters('tutor_answer_to_question_data', array(

RestAPI.php

$results = apply_filters('tutor/api/get_courses', $query);

Rewrite_Rules.php

$course_nav_items = apply_filters('tutor_course/single/enrolled/nav_items_rewrite', $course_nav_items);

Shortcode.php

return apply_filters( 'tutor/student/register', ob_get_clean() );
return apply_filters( 'tutor_dashboard/index', ob_get_clean() );
return apply_filters( 'tutor_dashboard/student/index', ob_get_clean() );

Student.php

wp_safe_redirect( apply_filters( 'tutor_student_register_redirect_url', $redirect_page, $user ) );

Template.php

$template_override = apply_filters('tutor_lms_should_template_override', true);
return apply_filters('tutor_lesson_template', $template);
$isPublicVideo = apply_filters('tutor_video_stream_is_public', false,  get_the_ID());

Tutor_List_Table.php

$views = apply_filters( "views_{$this->screen->id}", $views );
$this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions );
if ( apply_filters( 'disable_months_dropdown', false, $post_type ) ) {
$months = apply_filters( 'months_dropdown_results', $months, $post_type );
return (int) apply_filters( "{$option}", $per_page );
$column  = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
$_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );

Tutor_Setup.php

apply_filters('tutor_wizard_attributes', array());

Upgrader.php

apply_filters( 'tutor_in_plugin_update_message', $upgrade_notice ? '</p> <div class="tutor_plugin_update_notice">' .$upgrade_notice. '</div> <p class="dummy">' : '' );

Utils.php

apply_filters($key, $option[$key]);
apply_filters($key, $new_option);
apply_filters( 'active_plugins', get_option( 'active_plugins' ));
apply_filters( 'active_plugins', get_option( 'active_plugins' ));
apply_filters( 'active_plugins', get_option( 'active_plugins' ));
apply_filters( 'active_plugins', get_option( 'active_plugins' ));
apply_filters('tutor/utils/languages', $language_codes);
apply_filters('tutor_course_contents_post_types', array($lesson_post_type, 'tutor_quiz')),
apply_filters('is_course_paid', false, $course_id);
apply_filters('is_course_purchasable', false, $course_id);
apply_filters('get_tutor_course_price', null, $course_id);
apply_filters('tutor_is_enrolled', $getEnrolledInfo, $course_id, $user_id);
apply_filters('tutor_course/single/enrolled/nav_items', $nav_items);
apply_filters('tutor_file_types_icon', array(
apply_filters( 'tutor/posts/attachments', $data );
apply_filters('tutor_video_types', array("mp4"=>"video/mp4", "webm"=>"video/webm", "ogg"=>"video/ogg"));
apply_filters('is_completed_course', false, $course_id, $user_id);
apply_filters('is_completed_course', $is_completed, $course_id, $user_id);
apply_filters('is_completed_course', false, $course_id, $user_id);
apply_filters('tutor_enroll_data',

apply_filters(
	$nav_items = apply_filters('tutor_dashboard/nav_items', array(

apply_filters('tutor_dashboard/nav_items_all', $all_nav_items);
apply_filters('tutor_dashboard/permalinks', array(
apply_filters('tutor_dashboard/nav_ui_items', $nav_items);
apply_filters('tutor_instructor_statuses', array(
apply_filters('tutor_course_level', array(
apply_filters('tutor_public_profile/permalinks', $permalinks);
apply_filters('tutor_dashboard_page_id', $page_id);
apply_filters('tutor_dashboard_page_id', $page_id);
apply_filters('tutor_social_share_icons', $icons);
apply_filters('tutor_user_social_icons', $icons);
apply_filters('tutor_get_screen_ids', $screen_ids);
apply_filters('get_tutor_currency_symbol', $symbol);
apply_filters('tutor_get_flash_msg', $msg, $name);
apply_filters('tutor_get_course_categories_args', array(
apply_filters('tutor_get_course_categories_terms_args', array(
apply_filters('tutor_referer_url', $url);
apply_filters('tutor_pages', array(

Video_Stream.php

apply_filters('tutor_video_types', array("mp4"=>"video/mp4", "webm"=>"video/webm", "ogg"=>"video/ogg")) ;

Withdraw.php

apply_filters('tutor_withdraw_methods', $methods);

apply_filters('tutor_withdraw_options_input', $option);

apply_filters('tutor_withdraw_method_set_success_msg', __('Withdraw account has been set successfully', 'tutor'));

apply_filters('tutor_no_withdraw_method_msg', __('Please save withdraw method ', 'tutor')  );

apply_filters('tutor_required_min_amount_msg', sprintf(__('Minimum withdraw amount is %s %s %s ', 'tutor') , '<strong>', $formatted_min_withdraw_amount, '</strong>' ) );

apply_filters('tutor_pre_withdraw_data', array(

apply_filters('tutor_withdraw_successful_msg', __('Withdraw has been successful', 'tutor'));

Withdraw_Requests_List.php

apply_filters('tutor_should_withdraw_delete', true);

WooCommerce.php

apply_filters('tutor_new_earning_data', array_merge($earning_data, $fees_deduct_data));

tutor-general-functions.php

wp-content/plugins/tutor/includes

apply_filters( 'tutor_placeholder_img_src', $src );
apply_filters('tutor_course_categories_dropdown_args', array_merge($default, $args));
apply_filters('tutor_course_categories_checkbox_args', array_merge($default, $args);
apply_filters( 'course_categories_pmpro_args', $args );

tutor-template-functions.php


apply_filters( 'tutor_get_template_path', $template_location, $template );

apply_filters( 'get_tutor_load_template_variables', $variables);
apply_filters( 'should_tutor_load_template', true, $template, $variables);
apply_filters( 'get_tutor_load_template_variables', $variables );
apply_filters( 'tutor_get_template_part_path', $template_location, $template );

apply_filters( 'tutor_course_loop_start', ob_get_clean());
apply_filters( 'tutor_course_loop_end', ob_get_clean() );

apply_filters( 'tutor_course_archive_pagination', ob_get_clean() );

apply_filters( 'tutor_course_loop_before_content', ob_get_clean() );
apply_filters( 'tutor_course_loop_after_content', ob_get_clean() );

apply_filters( 'tutor_course_loop_title', ob_get_clean() );
apply_filters( 'tutor_course_loop_header', ob_get_clean() );
apply_filters( 'tutor_course_loop_footer', ob_get_clean() );

apply_filters( 'tutor_course_loop_start_content_wrap', ob_get_clean() );
apply_filters( 'tutor_course_loop_end_content_wrap', ob_get_clean() );

apply_filters( 'tutor_course_loop_thumbnail', ob_get_clean() );
apply_filters( 'tutor_course_loop_wrap_classes', array(
apply_filters( 'tutor_course_loop_col_classes', array(
apply_filters( 'tutor_container_classes', array(

apply_filters( 'tutor_post_class', array(
apply_filters( 'tutor_course_archive_filter_bar', ob_get_clean() );
apply_filters( 'tutor_widget_course_loop_classes', array(

apply_filters( 'tutor_course_thumbnail_size', $size, $post_id );

apply_filters( 'tutor_course_loop_meta', ob_get_clean() );
apply_filters( 'tutor_course_loop_author', ob_get_clean() );
apply_filters( 'tutor_course_sell_by', null);
apply_filters( 'tutor_course_loop_price', ob_get_clean() );
apply_filters( 'tutor_course_loop_rating', ob_get_clean() );

apply_filters( 'tutor_course_loop_add_to_cart_link', ob_get_clean() );
apply_filters( 'tutor_course_price', ob_get_clean() );
apply_filters( 'tutor_get_the_excerpt', $get_post->post_excerpt );
apply_filters( 'get_tutor_course_author', get_the_author_meta( 'display_name', $post->post_author ) );

apply_filters( 'tutor_course/single/benefits', $array, $course_id );
apply_filters( 'tutor_course/single/benefits_html', ob_get_clean() );
apply_filters( 'tutor_course/single/topics', ob_get_clean() );
apply_filters( 'tutor_course/single/requirements', $array, $course_id );
apply_filters( 'tutor_course/single/requirements_html', ob_get_clean() );
apply_filters( 'tutor_course/single/target_audience', $array, $course_id );
apply_filters( 'tutor_course/single/audience_html', ob_get_clean() );
apply_filters( 'tutor_course/single/material_includes', $array, $course_id );
apply_filters( 'tutor_course/single/material_includes', ob_get_clean() );

apply_filters( 'tutor_course/single/instructors_html', ob_get_clean() );
apply_filters( 'tutor_course/single/reviews_html', ob_get_clean() );
apply_filters( 'tutor_review_disabled_text', '');
apply_filters( 'tutor_course/single/reviews_form', ob_get_clean() );
apply_filters( 'tutor_course/single/content', ob_get_clean() );
apply_filters( 'tutor_course/single/lead_info', ob_get_clean() );
apply_filters( 'tutor_course/single/enrolled/lead_info', ob_get_clean() );
apply_filters( 'tutor_course/single/enrolled', ob_get_clean() );
apply_filters( 'tutor_course/single/enroll', ob_get_clean() );
apply_filters( 'tutor_course/single/'.$template, ob_get_clean() );
apply_filters( 'tutor_course/global/login', ob_get_clean() );
apply_filters( 'tutor_course/single/enrolled/nav', ob_get_clean() );
apply_filters( 'tutor_course/single/video', ob_get_clean() );
apply_filters( 'tutor_lesson/single/attachments', ob_get_clean() );
apply_filters( 'tutor_lesson/single/lesson_sidebar', ob_get_clean() );
apply_filters( 'tutor_lesson/single/content', ob_get_clean() );
apply_filters( 'tutor_course/single/complete_form', ob_get_clean() );
apply_filters( 'tutor_course/single/completing-progress-bar', ob_get_clean() );
apply_filters( 'tutor_course/single/question_and_answer', ob_get_clean() );
apply_filters( 'tutor_course/single/announcements', ob_get_clean() );
apply_filters( 'tutor_single_quiz/top', ob_get_clean() );
apply_filters( 'tutor_single_quiz/body', ob_get_clean() );
apply_filters( 'tutor_single_quiz/content', ob_get_clean() );
apply_filters( 'tutor_single_quiz/no_course_belongs', ob_get_clean() );
apply_filters( 'tutor_single_quiz/single_quiz_contents', ob_get_clean() );
apply_filters( 'tutor_course/single/tags_html', ob_get_clean() );
apply_filters( 'tutor_lesson/single/sidebar_question_and_answer', ob_get_clean() );
apply_filters( 'tutor_course/single/social_share', ob_get_clean() );
apply_filters( 'tutor_assignment/single/content', ob_get_clean() );
apply_filters( 'tutor/single/next_previous_pagination', ob_get_clean() );
apply_filters( 'tutor_course/global/login', ob_get_clean());
apply_filters( 'tutor_login_form_popup_html', $output);

dashboard.php

wp-content/plugins/tutor/templates

apply_filters('frontend_course_create_url', admin_url("post-new.php?post_type=".tutor()->course_post_type)); ?>">

single-preview-lesson.php

apply_filters('tutor_course/contents/lesson/title', $lesson_title, get_the_ID());

create-course.php

wp-content/plugins/tutor/templates/dashboard

apply_filters('tutor_course_builder_logo_src', tutor()->url . 'assets/images/tutor-logo.png');

index.php

apply_filters('frontend_course_create_url', admin_url("post-new.php?post_type=".tutor()->course_post_type));

registration.php

apply_filters('tutor_student_register_validation_errors', array());

registration.php

wp-content/plugins/tutor/templates/dashboard/instructor

apply_filters('tutor_instructor_register_validation_errors', array());

Profile.php

wp-content/plugins/tutor/templates/dashboard/settings

apply_filters('tutor_profile_edit_validation_errors', array());

reset-password.php

apply_filters('tutor_reset_password_validation_errors', array());

withdraw-settings.php

apply_filters('tutor_withdraw_account_field_type_data', array(

Login.php

wp-content/plugins/tutor/templates/global

apply_filters('tutor_lostpassword_url', wp_lostpassword_url()),

add-to-cart-edd.php

wp-content/plugins/tutor/templates/loop

$args = apply_filters( 'edd_purchase_link_defaults', array(

add-to-cart-woocommerce.php

apply_filters('tutor_enroll_required_login_class', 'cart-required-login');
apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product );
apply_filters( 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok.

Header.php

apply_filters('tutor_wishlist_btn_class', 'tutor-course-wishlist-btn');
apply_filters('tutor_popup_login_class', 'cart-required-login');

Rating.php

apply_filters('tutor_course_rating_average', $course_rating->rating_avg);
apply_filters('tutor_course_rating_count', $course_rating->rating_count );

content.php

wp-content/plugins/tutor/templates/single/assignment

apply_filters('tutor_assignment/single/results/after', ob_get_clean(), $submit_id, $assignment_id ); ?>

add-to-cart-woocommerce.php

wp-content/plugins/tutor/templates/single/course

apply_filters( 'tutor_course_add_to_cart_form_action', get_permalink( get_the_ID() ) ) ); ?>"

Add-to-cart.php

apply_filters('tutor_enroll_required_login_class', 'cart-required-login');
apply_filters( 'tutor_enroll_form_classes', array(
apply_filters('tutor_course_sell_by', null);

Course-topics.php

apply_filters('tutor_course/contents/lesson/title', $lesson_title, get_the_ID());

Review-form.php

apply_filters( 'tutor_course/global/login', ob_get_clean());

Wc-price-html.php

apply_filters('get_tutor_course_price', null, get_the_ID());

Body.php

wp-content/plugins/tutor/templates/single/quiz

apply_filters('tutor_quiz/previous_attempts_html', $previous_attempts_html, $previous_attempts, $quiz_id);

form-retrieve-password.php

wp-content/plugins/tutor/templates/template-part

apply_filters( 'tutor_reset_password_message', esc_html__( 'Enter Password and Confirm Password to reset your password', 'tutor' )

Add_new_instructor.php

wp-content/plugins/tutor/views/pages

apply_filters('tutor_instructor_register_validation_errors', array());

enable_disable_addons.php

apply_filters('tutor_addons_lists_config', array());

tutor_pro_addons.php

apply_filters('tutor_pro_addons_lists_for_display', array());

REST_Response.php

apply_filters( 'tutor_rest_response', $response );

REST_Course.php

apply_filters( 'tutor_rest_course_thumbnail_size', 'post-thumbnail' );

apply_filters( 'tutor_rest_course_single_post', $post );

apply_filters( 'tutor_course_additional_info', $detail );

apply_filters( 'tutor_rest_course_by_terms_query_args', $args );

apply_filters( 'tutor_rest_course_sort_by_price_args', $args );

apply_filters( 'tutor_rest_course_query_args', $args );

Was this helpful?