LLMS_Post_Types::register_taxonomies()
Register Taxonomies
Return Return
(void)
Source Source
File: includes/class.llms.post-types.php
public static function register_taxonomies() {
// Course cat.
self::register_taxonomy(
'course_cat',
array( 'course' ),
array(
'label' => __( 'Course Categories', 'lifterlms' ),
'labels' => array(
'name' => __( 'Course Categories', 'lifterlms' ),
'singular_name' => __( 'Course Category', 'lifterlms' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Course Categories', 'lifterlms' ),
'all_items' => __( 'All Course Categories', 'lifterlms' ),
'parent_item' => __( 'Parent Course Category', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Course Category:', 'lifterlms' ),
'edit_item' => __( 'Edit Course Category', 'lifterlms' ),
'update_item' => __( 'Update Course Category', 'lifterlms' ),
'add_new_item' => __( 'Add New Course Category', 'lifterlms' ),
'new_item_name' => __( 'New Course Category Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( 'course_cat' ),
'hierarchical' => true,
'query_var' => true,
'show_admin_column' => true,
'show_ui' => true,
'rewrite' => array(
'slug' => _x( 'course-category', 'slug', 'lifterlms' ),
'with_front' => false,
'hierarchical' => true,
),
'show_in_llms_rest' => true,
)
);
// Course difficulty.
self::register_taxonomy(
'course_difficulty',
array( 'course' ),
array(
'label' => __( 'Course Difficulties', 'lifterlms' ),
'labels' => array(
'name' => __( 'Course Difficulties', 'lifterlms' ),
'singular_name' => __( 'Course Difficulty', 'lifterlms' ),
'menu_name' => _x( 'Difficulties', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Course Difficulties', 'lifterlms' ),
'all_items' => __( 'All Course Difficulties', 'lifterlms' ),
'parent_item' => __( 'Parent Course Difficulty', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Course Difficulty:', 'lifterlms' ),
'edit_item' => __( 'Edit Course Difficulty', 'lifterlms' ),
'update_item' => __( 'Update Course Difficulty', 'lifterlms' ),
'add_new_item' => __( 'Add New Course Difficulty', 'lifterlms' ),
'new_item_name' => __( 'New Course Difficulty Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( array( 'course_difficulty', 'course_difficulties' ) ),
'hierarchical' => false,
'query_var' => true,
'show_admin_column' => true,
'show_ui' => true,
'rewrite' => array(
'slug' => _x( 'course-difficulty', 'slug', 'lifterlms' ),
'with_front' => false,
),
'show_in_llms_rest' => true,
)
);
// Course tag.
self::register_taxonomy(
'course_tag',
array( 'course' ),
array(
'label' => __( 'Course Tags', 'lifterlms' ),
'labels' => array(
'name' => __( 'Course Tags', 'lifterlms' ),
'singular_name' => __( 'Course Tag', 'lifterlms' ),
'menu_name' => _x( 'Tags', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Course Tags', 'lifterlms' ),
'all_items' => __( 'All Course Tags', 'lifterlms' ),
'parent_item' => __( 'Parent Course Tag', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Course Tag:', 'lifterlms' ),
'edit_item' => __( 'Edit Course Tag', 'lifterlms' ),
'update_item' => __( 'Update Course Tag', 'lifterlms' ),
'add_new_item' => __( 'Add New Course Tag', 'lifterlms' ),
'new_item_name' => __( 'New Course Tag Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( 'course_tag' ),
'hierarchical' => false,
'query_var' => true,
'show_admin_column' => true,
'show_ui' => true,
'rewrite' => array(
'slug' => _x( 'course-tag', 'slug', 'lifterlms' ),
'with_front' => false,
),
'show_in_llms_rest' => true,
)
);
// Course track.
self::register_taxonomy(
'course_track',
array( 'course' ),
array(
'label' => __( 'Course Track', 'lifterlms' ),
'labels' => array(
'name' => __( 'Course Tracks', 'lifterlms' ),
'singular_name' => __( 'Course Track', 'lifterlms' ),
'menu_name' => _x( 'Tracks', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Course Tracks', 'lifterlms' ),
'all_items' => __( 'All Course Tracks', 'lifterlms' ),
'parent_item' => __( 'Parent Course Track', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Course Track:', 'lifterlms' ),
'edit_item' => __( 'Edit Course Track', 'lifterlms' ),
'update_item' => __( 'Update Course Track', 'lifterlms' ),
'add_new_item' => __( 'Add New Course Track', 'lifterlms' ),
'new_item_name' => __( 'New Course Track Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( 'course_track' ),
'hierarchical' => true,
'query_var' => true,
'show_admin_column' => true,
'show_ui' => true,
'rewrite' => array(
'slug' => _x( 'course-track', 'slug', 'lifterlms' ),
'with_front' => false,
'hierarchical' => true,
),
'show_in_llms_rest' => true,
)
);
// Membership cat.
self::register_taxonomy(
'membership_cat',
array( 'llms_membership' ),
array(
'hierarchical' => true,
'label' => __( 'Membership Categories', 'lifterlms' ),
'labels' => array(
'name' => __( 'Membership Categories', 'lifterlms' ),
'singular_name' => __( 'Membership Category', 'lifterlms' ),
'menu_name' => _x( 'Categories', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Membership Categories', 'lifterlms' ),
'all_items' => __( 'All Membership Categories', 'lifterlms' ),
'parent_item' => __( 'Parent Membership Category', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Membership Category:', 'lifterlms' ),
'edit_item' => __( 'Edit Membership Category', 'lifterlms' ),
'update_item' => __( 'Update Membership Category', 'lifterlms' ),
'add_new_item' => __( 'Add New Membership Category', 'lifterlms' ),
'new_item_name' => __( 'New Membership Category Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( 'membership_cat' ),
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => _x( 'membership-category', 'slug', 'lifterlms' ),
'with_front' => false,
'hierarchical' => true,
),
'show_in_llms_rest' => true,
)
);
// Membership tag.
self::register_taxonomy(
'membership_tag',
array( 'llms_membership' ),
array(
'hierarchical' => false,
'label' => __( 'Membership Tags', 'lifterlms' ),
'labels' => array(
'name' => __( 'Membership Tags', 'lifterlms' ),
'singular_name' => __( 'Membership Tag', 'lifterlms' ),
'menu_name' => _x( 'Tags', 'Admin menu name', 'lifterlms' ),
'search_items' => __( 'Search Membership Tags', 'lifterlms' ),
'all_items' => __( 'All Membership Tags', 'lifterlms' ),
'parent_item' => __( 'Parent Membership Tag', 'lifterlms' ),
'parent_item_colon' => __( 'Parent Membership Tag:', 'lifterlms' ),
'edit_item' => __( 'Edit Membership Tag', 'lifterlms' ),
'update_item' => __( 'Update Membership Tag', 'lifterlms' ),
'add_new_item' => __( 'Add New Membership Tag', 'lifterlms' ),
'new_item_name' => __( 'New Membership Tag Name', 'lifterlms' ),
),
'capabilities' => self::get_tax_caps( 'membership_tag' ),
'show_ui' => true,
'show_in_menu' => 'lifterlms',
'query_var' => true,
'show_admin_column' => true,
'rewrite' => array(
'slug' => _x( 'membership-tag', 'slug', 'lifterlms' ),
'with_front' => false,
),
'show_in_llms_rest' => true,
)
);
// Course/membership visibility.
self::register_taxonomy(
'llms_product_visibility',
array( 'course', 'llms_membership' ),
array(
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => false,
'query_var' => is_admin(),
'rewrite' => false,
'public' => false,
)
);
// Access plan visibility.
self::register_taxonomy(
'llms_access_plan_visibility',
array( 'llms_access_plan' ),
array(
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => false,
'query_var' => is_admin(),
'rewrite' => false,
'public' => false,
)
);
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.34.1 | Add custom property show_in_llms_rest set to true by default to those taxonomies we want to show in LLMS REST api. |
| 3.30.3 | Removed duplicate array keys when registering course_tag taxonomy. |
| 1.0.0 | Introduced. |