Skip to content

Instantly share code, notes, and snippets.

@MrVibe
Created June 23, 2020 06:36
Show Gist options
  • Save MrVibe/0c3067e68a952e41792043ebe619dba8 to your computer and use it in GitHub Desktop.
Save MrVibe/0c3067e68a952e41792043ebe619dba8 to your computer and use it in GitHub Desktop.
Load courses only from a cateogry XX in the mobile app.
add_action('rest_api_init',function(){
add_filter('bp_course_wplms_filters',function($args){
if(empty($args['tax_query'])){
$args['tax_query']=array(
'relation' => 'AND',
array(
'taxonomy'=>'course-cat',
'field'=>'id',
'terms' =>array('xx','xx')
)
);
}else{
$args['tax_query'][]=array(
'taxonomy'=>'course-cat',
'field'=>'id',
'terms' =>array('xx','xx')
);
}
return $args;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment