Course Builder Custom Fields

Course Builder Custom Fields help to customize Course Builder by adding fields like:

  • input (text, number, radio, checkbox, date, ..)

  • textarea

  • select

Registering Custom Fields

Course, Lesson, and Quiz Custom Fields could be added using filters:

  • masterstudy_lms_course_custom_fields

  • masterstudy_lms_lesson_custom_fields

  • masterstudy_lms_quiz_custom_fields

Example:

function masterstudy_lms_custom_fields( $custom_fields ) {
	$quiz_custom_fields = array(
		array(
			'type'    => 'text',
			'name'    => 'my-text-field',
			'label'   => __( 'Text field', 'masterstudy-lms-learning-management-system' ),
		),
		...
	);

	return array_merge( $custom_fields, $quiz_custom_fields );
}

add_filter( 'masterstudy_lms_course_custom_fields', 'masterstudy_lms_custom_fields' );

How to filter custom fields before sending to Course Builder

Course Builder Custom Fields could be filtered before sending to Course Builder using masterstudy_lms_course_builder_custom_fields filter.

Example:

Processing Input Data

All input data will be automatically saved to post_meta. Additionally, data can be used with action:

Parameters:

  • $post_id int Course, Lesson, or Quiz Post ID.

  • $data array key => value array of Custom Fields

Example:

Custom Field Types

There are text, textarea, number, checkbox, radio and select types of custom fields. Let's look at examples of each.

Text

Textarea

Number

Checkbox

Radio

Select

Full Example

Here is an example of all custom field types with filters used:

Last updated

Was this helpful?