Improving Related course accuracy

The following tip will improve related course accuracy in modern theme.

Currently the Related courses pick the courses from the same category to which the current course is connected to. The relation between category and courses is “or”.

Following tip will identify if the course is connected to a child category, then it will use only the child category for listing out related courses.

Paste this code in Child theme – Functions.php or Wp admin – Plugins – Editor – Wplms customiser – wplms_customiser.php

function wplms_related_course_child_category($args){
	global $post;
	$terms = wp_get_post_terms($post->ID,'course-cat');
	$categories = array();
		foreach($terms as $term){
				$categories[] = $term->term_id;
		return $args;		
	$args['tax_query'][0]['terms'] = $categories;

	return $args;



Leave a Reply

Your email address will not be published. Required fields are marked *